Some JSF notes

March 31, 2007

While working on the JSF tutorials, I observed a few things:

We can change the error messages for reqired fields by changing messages.properties or creating our own MyMessages.properties and pointing to it from the faces-config.xml file. Messages for the properties we do not change will continue to be served form messages.properties.

In a custom Validator we can set the severity of error messages. I tried setting the severity of a error message to Severity.ERROR, but it resulted in a compilation error. The correct constant was FacesMessage.SEVERITY_ERROR. Hmmmm I would have thought Severity.ERROR was a better choice… especially since it already exists in the Severity class.

To use a custom converter we have to use the tag <f:converter …> but to use one of the default converters like the DateTimeConverter we use another tag <f:convertDateTime …> I think they should have just used the f:converter tag and supplied some default converters for us. This would have kept the tag library simpler and uniform.

Advertisements