My Personal Online Recycle Bin
You may find something useful here...........

Thursday, January 12, 2006

Strongly recommend using Myfaces jsf jar

As you may know Java Sun jsf provide 2 tag library there are core(f:) and html(h:) tag libraries. But you may not know that Apache Myfaces also provide both these 2 enhanced libraries.

One of the goodies about Apache Myfaces tag libraries is the h:message/h:messages tag provide a more meaningful message then the java sun library.

For example,

Example error message if using java sun jsf library
Validation Error: Value is required


Example error message if using apache jsf library
Validation Error ("Name"): Value is required

where Name is the id tag attribute of the html components.

If you want to used Apache Myfaces library, make sure you delete the java sun jar (jsf-impl.jar and jsf-api.jar). So it wouldn't conflict/duplicate with myfaces jar(myfaces-jsf-impl.jar and myfaces-jsf-api.jar)

Beside, I also would like to highlight on the Tomahawk tag libarry provided by myfaces. Tomahawk not just only provide new components (such as calendar, JSCook Menu and etc) and new validator (such as validateCreditCard, validateEmail and etc). But it also provide forceId attribute for all standard component(such as htmlInputText) that allows you to set the id of a component to a fixed value. This feature is very important when you are using javascript. Because jsf will automate prefix a form id in front of a component id.

For example, if your form id is "form1". And you have a textbox id is "textbox1" within the form1. Then jsf will generate the id as "form1:textbox1" which is very unconvenient/impossible to be used in javascript.

If you did have any good tutorials or article on jsf, may be you could share it with me.....

Monday, January 09, 2006

Java Server Face - Validate Date

If you did look into the java server face tag, you will notice there is always f:validate.... tag to do validation. That make me thought there is no validator tag for date format.

But I strongly feel that is not truth because validate date format is a very common behaviour. JSF should have provide this feature.

After some times, I noticed that f:convertDateTime tag should be used to validate date/time format. The name is really confusing me.

<h:inputtext id="textfield" value="#{bean.property}">
<f:convertdatetime pattern="dd/MM/yyyy">
</h:inputText>
<h:message for="textField">


Beside that, I found the following url is useful jsf resource.
1)MyFaces
2)JSF FAQ