Friday Jul 11, 2008

Generic Web Page Designer for Netbeans, anyone?

Visual JSF designer in Netbeans provides a way to design a web page visually. Unfortunately, Visual JSF web page designing is limited  to JSP based JSF web pages created by Visual JSF framework. However, Netbeans users might want to design web pages created by various frameworks. Such pages include HTML, PHP, JSP, RHTML (Ruby on  Rails), XML (facelet) etc. So I thought it is worth a time to explore the concept of a generic Web  Page Designer, with out any restrictions of any particular framework. If you are interested, you can read my proposal for a generic Web Page Designer at The proposal includes Web Page Designer Concept Overview and Web Page Designer Design Concepts.

Web Page Designer

I also spent some time to create a prototype of a HTML designer. This designer will be the foundational designer for all other page designers (like PHP, JSP etc). Other page designers would be extended from this designer. This is obvious because HTML is a subset in all page types.

This HTML designer embeds Mozilla Layout Engine (XULRunner) for rendering the web pages. Therefore, unlike Visual JSF designer, user would get hi-fidelity rendering of the web pages. Details on embedding Mozilla in Netbeans is available here.

I've used JAVA-XPCOM API to interact with underlying XULRunner to facilitate page design. Unlike other Mozilla based Web Page authoring tools like NVU, in this designer I'm not exposing the Mozilla Composer, but directly manipulating the Mozilla DOM for visual editing. The advantage is, I can execute JavaScript on demand using XurRunner API. This helps me to render JavaScript based Web 2.0 AJAX widgets (Yahoo, jMaki, Google etc) in the designer. This unique feature I've not seen available in any of the popular WYSIWYG HTML designers, I could lay my hand on, like DreamWeaver or Microsoft expression. Another interesting feature I implemented, is the direct manipulations of CSS style of a HTML element selected in the designer using the Style Builder view docked in the bottom. Any modification of a CSS property in the Style Builder is immediately reflected in the designer.

Oh!, but one bigger question still bothers me - Are Netbeans users really interested in a Web Page Designer or am I just wasting my time?

Saturday Jun 07, 2008

Assemble your Widgets and create a Social Web Application using Zembly

Earlier, using tools like Netbeans and Visual Web, you could easily whip up an Ajax enabled Web Application. Now, Sun Microsystems introduces another interesting Web Development Environment, Zembly, a hosted environment designed to build Social Web Applications from the web itself. Nothing to download, every thing is on the web.


With Zembly, you can quickly and easily develop applications for Facebook, Meebo, OpenSocial, iPhone (to name a few) and other Social Web Applications. It makes it a snap to create embeddable widgets for  google, flickryahoo (again to name a few) gadgets,  that can be distributed to millions of users on the web.

Zembly Editors

Zembly allows you to author Social Web Applications and Widgets using advanced editors running directly in your browser. The editors provides support for code completion , full syntax highlighting for JavaScript, XML, CSS, HTML etc

Zembly Editors

Zembly is released as a private Beta and access is permitted for invitatees only. If you are interested to take it for a test drive, request  an invitation using the following widget.

Saturday May 17, 2008

Visual Web FAQ revised for NB 6.1

The contents of the Netbeans Visual Web FAQ has been revised for the Netbeans 6.1 release.

This FAQ is not created by development team or doc team, but a collection from articles contributed by various developers and users from blogs, forum etc. Any interested contributer can add to this FAQ. Details at

The main topics covered in this FAQ are

  •  Visual Web Application general concepts
  •  Components
    •  General
    •  Input Components
    •  Output Components
    •  Action Components
    •  Layout Components
    •  AJAX Sample Components
    •  Table Components
    •  Selection Components
    •  Standard Components
    •  Converters and Validators
    •  Data Providers and Binding
    •  Processing and Lifecycle
    •  Portlets and Portal Servers
  •  Migrating From Previous Versions
  •  Database Access
  •  Working with Deployment Servers
  •  Troubleshooting
  •  Working with Java Source Code

Saturday Apr 19, 2008

VW user tip1: A workaround for validation messages translation issues

This useful tip was sent to me by Jorge Campins. In this tip Jorge gives a solution to fix the problem related to intermixing of translated messages (Spanish, applies to other languages also) and English, which he jokingly calls as "Spanglish". Especially, this is a case with standard components and its Converters and Validators.

For other user tips, visit  Netbeans Visualweb user tips and code snippets

We wouldn’t know about other languages, but if you are developing with NetBeans 6 there are some translation issues you should solve before releasing your applications to Spanish speaking end-users. Here we specifically address those issues at JSF core components such as Converters and Validators. These issues include not translated, partially translated and wrongfully translated messages; also visual component ids appearing as part of the message, which is very helpful for the programmer but very confusing for the end-user. Fortunately, we were able to deal with all these in an easy way, based on the approach suggested by Dr. Winston Prakash. All we had to do was to build a translation routine and execute it at the prerender event. It was particularly easy for us because we already had all our pages calling some helper methods at prerender, so we didn’t had to modify every page to call the new translator routine. The following is an example of a translation routine based on the one we built:

public static void fixFacesMessages() {
FacesContext facesContext = FacesContext.getCurrentInstance();
UIViewRoot uivr = facesContext.getViewRoot();
Iterator messageClientIds = facesContext.getClientIdsWithMessages();
while (messageClientIds.hasNext()) {
String clientId =;
if (clientId != null) {
UIComponent uic = uivr == null ? null : uivr.findComponent(clientId);
Iterator messages = facesContext.getMessages(clientId);
while (messages.hasNext()) {
FacesMessage facesMessage =;
// Get the messages
String detail = facesMessage.getDetail();
String summary = facesMessage.getSummary();
// translate
String detalle = getMensaje(uic, detail);
String resumen = getMensaje(uic, summary);
// Set your own message

private static String getMensaje(UIComponent uic, String message) {
FacesContext facesContext = FacesContext.getCurrentInstance();
String mensaje = StringUtils.trimToEmpty(message);
if (uic != null) {
mensaje = trimPrefix(mensaje, uic.getClientId(facesContext));
mensaje = trimPrefix(mensaje, uic.getId());
mensaje = trimPrefix(mensaje, ": ");
mensaje = trimPrefix(mensaje, "Validation Error: ");
mensaje = trimPrefix(mensaje, "Error de Validación: ");
mensaje = trimSuffix(mensaje, "Example:");
mensaje = trimSuffix(mensaje, "Ejemplo:");
mensaje = mensaje.replace(
"is not a number",
"debe ser un número");
mensaje = mensaje.replace(
"must be a number consisting of one or more digits",
"debe ser un número");
mensaje = mensaje.replace(
"must be a number between",
"debe ser un número entre");
mensaje = mensaje.replace(
"Specified attribute is not between the expected values of",
"El valor debe estar comprendido entre");
mensaje = mensaje.replace(
" and ",
" y ");
\* We always use the maxLength property of the TextField component to avoid
\* length errors on string fields, so only TextArea components need a Length
\* validator. Therefore, only if the component is a TextArea we need to
\* change the subject of the sentence.
String sujeto = uic instanceof TextArea
? "La longitud del valor"
: "El valor";
mensaje = mensaje.replace(
"Valor es más grande de valor de máximo permitido:",
sujeto + " debe ser menor o igual que");
mensaje = mensaje.replace(
"Valor is menos de valor de mínimo permitido:",
sujeto + " debe ser mayor o igual que");
return mensaje;

public static String trimPrefix(String message, String prefix) {
String mensaje = StringUtils.trimToEmpty(message);
int i = mensaje.indexOf(prefix);
if (i >= 0) {
mensaje = mensaje.substring(i + prefix.length());
return mensaje;

public static String trimSuffix(String message, String suffix) {
String mensaje = StringUtils.trimToEmpty(message);
int i = mensaje.indexOf(suffix);
if (i > 0) {
mensaje = mensaje.substring(0, i);
return mensaje;

Sunday Apr 13, 2008

Netbeans Visualweb user tips and code snippets

I'm planning to post useful programming tidbits provided by Netbeans Visual Web users in my blog.  If you have any interesting tips, code snippets or ideas for enhancements and want to share them with others and get their comments, send me an e-mail at wjprakashATnetbeansDOTorg. I''l post them in my blog.

Sunday Jan 27, 2008

Creating your own Visual Web Page Layout Plugin

In two of my earlier blogs, I explained

Now I've written another article that provides step by step tutorial on how to create your own Page Layout plugin to make your own Page Layout appear in the New Visual Web Page Wizard. Read the complete article at


How to create your own Visual Web Page Layout Plugin


Monday Jan 14, 2008

No more mandatory component binding in Visual Web

Netbeans Visual Web Designer (NB 6.0 and before) mandates that each JSF component tag in the JSP must have a binding attribute which is bound to a property in the backing page bean via Expression Language binding. This ends up generation of getter and setters for each of the component in the page bean. Even though, this is convenient to set properties directly to the JSF component used in the page, this is very annoying because 95% of the components declared in the page Java source are not used and unnecessarily bloats the backing page bean.

For Netbeans 6.1 release this is going to change. Following changes have been implemented already and available in the Netbeans 6.1 nightly builds.

  • Newly created pages and page fragments will not have any binding attribute.
  • The generated Java source will not contain tons of getter and setters for corresponding properties.
  • The binding attribute in the JSP and corresponding property in the Java source will not be generated when a component is dropped on to the designer.
  • Users will have the option to add component binding using "Add binding attribute" context menu item of the component in the outline or designer.
  • Users will also have the option to remove component the binding using "Remove binding attribute" context menu item.

Here are some test results after the implementation

  • Create a project
  • In the page drop a table and copy and duplicate it to 20 tables
  • Copy the page and duplicate it to 128 pages.


  • Results With binding attribute for each component
    • Extremely slow to copy and create all the pages (more than 20 minutes)
    • Memory in the memory meter reached 512 MB and OME after copying about 95 pages
    • Copy all 128 pages after restarting IDE.
    • Final project size 10.2 MB
    • Restart IDE and Open project and 10 pages (switch to Java) - Memory 120/190 MB
  • Result With out binding  for each component
    • Reasonably faster to copy and create all the 128 pages (about 5-7 minutes)
    • Final Memory in the memory meter (after GC) 165/340 MB
    • Final project size 1.9 MB
    • Restart IDE and Open project and 10 pages (switch to Java) - Memory 75/140 MB

Monday Sep 17, 2007

Netbeans 6.0 Beta1 has been released

Today announced that it has released Netbeans Beta1.

It can be downloaded from the page

The News and Note Worthy in this release can be found at the wiki page 

From this NB 6.0 release onwards, to create or work with a J2EE 1.4 Visual Web project which will be deployed to a 1.4 J2EE application server, first you need to install the Visual Web JSF Backwards Compatibility Kit plugin. You can find the details at News and Note Worthy mentioned above.

Wednesday Dec 06, 2006

Final release of Visual Web Pack for Netbeans 5.5 is available now

Visual web pack for Netbeans 5.5 (VWP) has been released today. Thanks to all those who downloaded the Technology Preview of VWP and send us your valuable feedback. Hundreds of bugs have been fixed and several enhancements incorporated for the final release.

You can download the final release at

Continue to provide us with your suggestions and enhancement request via Issuezilla for a better future release.


« October 2016