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 by Jacob Hookom on October 12, 2006 at 04:19 PM MDT #
Posted by Brad Smith on October 12, 2006 at 05:19 PM MDT #
Posted by Jeff on October 12, 2006 at 05:27 PM 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 05:35 PM MDT #
Posted by Jeff on October 12, 2006 at 05:41 PM MDT #
Posted by Matt Raible on October 12, 2006 at 05:49 PM MDT #
Posted by Jim Robinson on October 26, 2006 at 11:23 PM MDT #
Posted by Matt Raible on October 26, 2006 at 11:27 PM MDT #
Posted by anonymous on December 28, 2006 at 03:26 PM MST #