Monday, 31 August 2009

NetBeans Maven Wep Application Internationalization

As you know NetBeans 6.7 supports Maven projects. And you must also know what Maven is. Both are great products. Especially together. With IceFaces.
If you know both Maven and NetBeans you have most probably already tried to create a web application - a facelets based one - in NetBeans using Maven webapp archetype. This is what I tried together with IceFaces. ( By the way here is my icefaces-webapp-archetype if you have no other. )
But that is enough of free advertisement of REALLY GREAT PRODUCTS. ;)

My point is now internationalization of a Facelets based web application under a Maven based NetBeans project. As hopefully you know the standard/one way of JSF/Facelets internationalization is using f:loadBundle - or in case of IceFaces the better ice:loadBundle tag. But the location of the properties file is a bit tricky with maven based on my experience. Previously this must be located in the same directory as the java sources. But things are changing over time? Forget the old ones and learn new ones. The new location is "Other Sources->src/main/resources" directory. If you build a war with Maven then you can find the properties file in WEB-INF/classes and this is the right root directory. So do not put properties file under "Source Packages" anymore if you are using Maven and NetBeans together since Maven does not take those from there as I have seen many time.


( Versions: NetBeans 6.7.1 , Maven 2.2.1 )