Posted by cayhorstmann
on October 19, 2009 at 11:56 AM PDT
In the relentless fight against configuration boilerplate, JSF and Glassfish have taken yet another small step forward. As of Glassfish v3 build 68, you no longer need to declare the faces-servlet in WEB.XML.
In fact, you can omit web.xml altogether, except then you don't get to set
Development. (Since I am a developer, I think it's too bad that's not the default.)
GlassFish automatically provides a JSF servlet mapping for the
*.jsf patterns, provided that any of the following conditions applies:
- Any of the classes in the web application uses a JSF 2.0 annotation
- Any initialization parameters start with
WEB-INF/faces-config.xml file is present
Isn't it grand? Now you can have a JSF app without web.xml or faces-config.xml, just a bunch of .xhtml pages and Java classes annotated with
The only fly in the ointment is that, if you really want to be thoroughly modern and use web beans, erm, JSR 299 Contexts and Dependency Injection, then you should still leave something in place to trigger the servlet mapping.
Another nifty step forward: NetBeans 6.8 Milestone 2 now does autocompletion on JSF 2.0 facelets pages, including tags, attributes and even EL expressions.
For example, here, Netbeans has found a
@ManagedBean(name="user") and located
It might be a good idea to filter out the useless
Object methods—when is the last time you wanted to call
notifyAll in an EL expression? Or worse,
After EE5 came out, I did all my EE development in Netbeans. It gave me one-stop shopping, bundling everything that I needed in a single download. I moved to Eclipse when Netbeans couldn't deal with EE6 improvements such as the simplified packaging. It worked in Eclipse (out of ignorance, not some grand plan), and that's what I used for the last 12 months or so. I was reasonably satisfied, thanks to the Glassfish Eclipse plugin, but Eclipse's support for editing JSF pages is extremely basic. Now I am very tempted to go back to Netbeans—I am a sucker for autocompletion.