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
- Raible Road Trip #13
- The good ol' Job Hunt
- How to use GWT 2.0 with Maven and Generate SOYC Reports
- JSON Parsing with JavaScript Overlay Types in GWT
- A Fun Father's Day at Great Sand Dunes
- Going to the Great Sand Dunes for Father's Day
- Implementing OAuth with GWT
- Enhancing Evite.com with GWT and Grails
- 2nd Row at Red Rocks and Elephant Rock Ride
- Creating a Facebook-style Autocomplete with GWT
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 08:26 AM MST #