Thursday, July 13, 2006

Facelets on Resin

Facelets on Resin would have problems running 'out of the box'. Incorrectly parsed xml would break any attempts to use more or less complexc JavaScript. Other problems like removed DOCTYPE declarations, etc. are possible.

The problem lies in incompatiblities of Resin's xml parser. And it appears that override it pretty easy once you know where is the problem.

So, we download XML implementaion from apache: xercesImpl.jar

Then we put it in our /WEB-INF/lib/ directory

In WEB-INF/resin-web.xml (if it doesn't exist - create it, for syntax refer to the website of resin). Add the following entries:


<system-property javax.xml.parsers.DocumentBuilderFactory="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
<system-property javax.xml.parsers.SAXParserFactory="org.apache.xerces.jaxp.SAXParserFactoryImpl"/>


After that everything should be O.K.

It is possible of course to configure this on global level in Resin (check the docs again), but this works with default Resin installation.