HTTP GET, URL Rewriting, Multi Component Validation, and EL Method Invocation in JSF
Join the DZone community and get the full member experience.Join For Free
There is a project called Pretty Faces that adds HTTP GET and URL Rewriting to JSF 1.2. The project differentiates itself from JBoss Seam, RESTfaces and PrettyUrlPhaseListener by making the h:form tag submit to the pretty URL (/mapped/page) instead of the view Id (/faces/page.jsf). For a detailed description of why you should choose Pretty Faces instead of the others for HTTP GET and URL Rewriting in JSF 1.2, read this article on the OcpSoft website.
I contributed an initial Maven2 POM and directory layout to help the project owner get it into the central repository. The work is complete, and it looks like I've helped convert him into a Maven2 fan :)
I've been lobbying the JSF 2.0 expert group to add HTTP GET support for a while. Someone told me that Red Hat has donated additional resources (aka people) to the effort to make sure it gets done for JSF 2.0. I suggested that they get the author of Pretty Faces involved in the design or at least learn from his project because he thinks that he has done something above and beyond the current solutions. The expert group did contact him and he helped review several revision of the HTTP GET support that will soon be in the spec. He is happy with the way it turned out, and says that he is sure that HTTP GET will be in JSF 2.0.
The 1.x releases of Pretty Faces targets JSF 1.2, and the future 2.x releases will target JSF 2.0. The 2.x releases will likely have the HTTP GET feature stripped out leaving only the URL Rewriting feature, because JSF 2.0 will come with HTTP GET built in.
I have other good news related to JSF 2.0. For a long time I've been lobbying the JSF 2.0 and Java EE 6 expert groups for multi component validation support. I recently discovered someone's blog from 2004 suggesting that h:form supports validators like any other component. In the validator you could read the submitted values of any combination of input components and perform business validation. I recently summarized the idea and provided a link to the expert group. Today there were several commits on the multi component validation ticket in IssueZilla, and it shows that they implemented something similar but different. They found a way to take advantage of the new events feature in JSF 2.0. UIComponents will have a beforeValidate and afterValidate event. You can catch the h:form's afterValidate event, load the submitted values from the components you are interested in, validate them using business rules, add FacesMessages into FacesContext, then call renderResponse(). I imagine someone will be blogging about this feature and the HTTP GET support soon.
Browsing the blogsphere today I discovered even more good news. EL method invocation will be present in Java EE 6!
I have one last bit of news related to JSF 2.0. The RichFaces team is working on a version that uses JSF 2.0's new features, and they will be removing things that are no longer necessary such as Ajax4JSF.
Opinions expressed by DZone contributors are their own.