Thursday October 12, 2006
Integrating Facelets and Ajax4JSF with MyFaces
I spent a few hours tonight integrating Facelets into an AppFuse-based application. The integrating was fairly easy thanks to the work Thomas Gaudin did back in January. For the most part, it was just a matter of 1) replacing <fmt:message> tags with #{text['key']} tags, 2) replacing the <%@ include file="/common/taglibs.jsp"%> at the top of each page with Facelet's namespace tags and 3) renaming the pages from *.jsp to *.xhtml. The only thing that tripped me up was I thought the "c" namespace was the same as JTLS's URI, but it's actually a whole new URI. Thanks to the Facelets developers for a much-needed fix for JSF.
After I got Facelets integrated and working, I dove into integrating Ajax4JSF. Two hours later and I have the simple repeater demo working. What took so long? I spent an hour staring at (and googling for) the solution to the following error:
PhaseListenerManager.informPhaseListenersBefore(74) | Exception in PhaseListener RENDER_RESPONSE(6) beforePhase.
java.lang.NullPointerException
at com.sun.facelets.FaceletViewHandler.writeState(FaceletViewHandler.java:759)
at org.ajax4jsf.framework.renderer.AjaxRendererUtils.writeState(AjaxRendererUtils.java:850)
at org.ajax4jsf.framework.renderer.AjaxRendererUtils.encodeAreas(AjaxRendererUtils.java:740)
at org.ajax4jsf.framework.renderer.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:128)
at org.ajax4jsf.ajax.UIAjaxRegion.encodeAjax(UIAjaxRegion.java:210)
The solution turned out to be removing the FaceletsViewHandler from faces-config.xml:
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
Also, it seems the following is required in web.xml:
<context-param>
<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
Hopefully this helps others googling for the exception above.
Posted in Java
at Oct 12 2006, 02:41:24 AM MDT
9 Comments
Search This Site
Recent Entries
- Wine Tasting in Napa Valley
- How to build a Shot-Ski
- Bus Project Update
- Farewell to the 2011-2012 Ski Season
- Cruising around the Western Caribbean
- Spring Break!
- A Spectacular Trip to Stockholm and Madrid
- Comparing Web Frameworks and HTML5 with Play Scala at Jfokus 2012
- Play Framework 2.0 with Peter Hilton at Jfokus
- Secure JSON Services with Play Scala and SecureSocial
Posted by Jacob Hookom on October 12, 2006 at 10:19 AM MDT #
Posted by Brad Smith on October 12, 2006 at 11:19 AM MDT #
Posted by Jeff on October 12, 2006 at 11:27 AM MDT #
Jeff - pending approval from my client, hopefully it will go into 1.9.4 and 2.0 in the next couple weeks. I'd like to release 1.9.4 and 2.0 M1 before (or during) the Colorado Software Summit.
Posted by Matt Raible on October 12, 2006 at 11:35 AM MDT #
Posted by Jeff on October 12, 2006 at 11:41 AM MDT #
Posted by Matt Raible on October 12, 2006 at 11:49 AM MDT #
Posted by Jim Robinson on October 26, 2006 at 05:23 PM MDT #
Posted by Matt Raible on October 26, 2006 at 05:27 PM MDT #
Posted by anonymous on December 28, 2006 at 09:26 AM MST #