Recently in JSF Category

August 25, 2006

JSF Tags must be closed within the same file

Don't open a JSF tag and close it in a separate include file. It doesn't work because the XML won't validate, so don't try it! You will get an error like this:

The end tag "</f:view" is unbalanced

Interationalized text jumble

I have a page that can be toggled between 2 different layouts. One of the layouts contains extra text. When the same page is loaded twice back to back, once using each layout, some of the text gets jumbled. I suspect that the entries pulled out of the resource bundle are cached and they aren't being updated when the page is reloaded.

JSF 1.1 Quirk: Form fields must be defined before field labels

Form fields must be defined before field labels or else warnings will appear in JSF 1.1 but it will be fixed in version 1.2.

09:47:18,594 WARN [HtmlLabelRenderer] Unable to find component 'currency'
(calling findComponent on component 'signup:_id16')

These warnings can be ignored, as they don't affect the functionality of the
page. The warnings can also be suppressed or the form field labels may be defined
after the corresponding form fields and use CSS styling to make the labels
appear to the left of/ on top of their respective fields.

JSF element ID convention

JSF generates IDs for HTML elements by prepending subview ID's form ID's and such.

If you're using include files, this means the rendered element ID may not be what you expect.

Styles that rely on an element ID may not be applied to these elements, so check your HTML source before you define your ID-based styles. Alternatively, you can define style classes since the styleClass attribute is not modified upon rendering.

Tableless web design using Java Server Faces

There are times when I feel that no one bothered consult a user interface engineer when they came up with the specs for JSF. My latest grievance with JSF is that it doesn't seem to support tableless CSS layouts. In fact, it actually goes out of its way to render any JSF output elements outside of the div tags that I put around them. One solution around this is to create a custom component that renders div tags. Better yet, you can use Apache's MyFaces Tomahawk components. I'm sure there are many other component libraries that support the use of divs too, but I chose to use Tomahawk since I'm using MyFaces.

I believe the issue of supporting divs will be supported in JSF 1.2.

Categories

Pages