Richfaces and Facelets not working
ethnarch Jan 7, 2009 7:36 PMI have tried a few different configurations and am unable to get facelets to work with my companies current application.
I tried putting this in the web.xml
<context-param> <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name> <param-value>com.sun.facelets.FaceletViewHandler</param-value> </context-param>
When I do the above though my whole app fails to find any jsf files and I can't navigate to any pages.
This is our web.xml without the view handler
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>trak</display-name> <!-- *********** W E L C O M E ****************************************************** --> <welcome-file-list> <welcome-file>index.jsf</welcome-file> </welcome-file-list> <!-- *********** J S F ************************************************************** --> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <login-config> <auth-method>BASIC</auth-method> </login-config> <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> <!-- *********** S P R I N G F R A M E W O R K *********************************** --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/application-context-web.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- *********** R I C H F A C E S ********************************************** --> <context-param> <param-name>org.richfaces.SKIN</param-name> <param-value>DEFAULT</param-value> </context-param> <filter> <display-name>RichFaces Filter</display-name> <filter-name>richfaces</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> </filter> <filter-mapping> <filter-name>richfaces</filter-name> <servlet-name>Faces Servlet</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> <!-- Path to resource property files. --> <context-param> <param-name>resourcePath</param-name> <param-value>/WEB-INF/classes/resources</param-value> </context-param> <context-param> <param-name>customComCalGif</param-name> <param-value>/trak/pages/images/cal.gif</param-value> </context-param>
And this is the include section of the jsf page I am working on
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %> <%@ taglib uri="http://richfaces.org/rich" prefix="rich" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %> <%@ taglib uri="http://com.comanche.web.components" prefix="jrc" %>
As well as the a4j:include section
<%-- -------------------- --%> <%-- Begin Wizard Content --%> <f:facet name="header"> <h:outputText value="Using a4j:include for Wizard-like behaviour" /> </f:facet> <h:form id="form1"> <a4j:include viewId="/pages/proto/wstep1.xhtml" /> </h:form> <%-- -------------------- --%> <%-- End Wizard Content --%>
the wstep1.xhtml is the same one in the example code.
The output then looks like this:
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <div style="position:relative;height:140px;width:500px"> Test Text <h:panelGrid rowClasses="s1row" columns="3" columnClasses="wfcol1,wfcol2,wfcol3"> <h:outputText value="First Name:" /> <h:inputText id="fn" value="#{profile.firstName}" label="First Name" required="true" /> <rich:message for="fn" /> <h:outputText value="Last Name:" /> <h:inputText id="ln" value="#{profile.lastName}" label="Last Name" required="true" /> <rich:message for="ln" /> <h:outputText value="Company:" /> <h:inputText id="comp" value="#{profile.company}" label="Company" required="true" /> <rich:message for="comp"/> </h:panelGrid> <div class="navPanel"> <a4j:commandButton id="wizardNext" value="Next >>" style="float:right" action="next"/> </div> </div> </ui:composition>
Also I noticed that If I do a regular include
<%@ include file="/pages/proto/wstep1.xhtml" %>
It outputs this
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <div style="position:relative;height:140px;width:500px"> Test Text <table> <tbody> <tr class="s1row"> <td class="wfcol1">First Name:</td> <td class="wfcol2"><input id="frmMain:fn" type="text" name="frmMain:fn" /></td> <td class="wfcol3"><span id="frmMain:j_id_jsp_1545479442_75"></span></td> </tr> <tr class="s1row"> <td class="wfcol1">Last Name:</td> <td class="wfcol2"><input id="frmMain:ln" type="text" name="frmMain:ln" /></td> <td class="wfcol3"><span id="frmMain:j_id_jsp_1545479442_78"></span></td> </tr> <tr class="s1row"> <td class="wfcol1">Company:</td> <td class="wfcol2"><input id="frmMain:comp" type="text" name="frmMain:comp" /></td> <td class="wfcol3"><span id="frmMain:j_id_jsp_1545479442_81"></span></td> </tr> </tbody> </table> <div class="navPanel"> <input id="frmMain:wizardNext" name="frmMain:wizardNext" onclick="A4J.AJAX.Submit('j_id_jsp_1545479442_0','frmMain',event, {'parameters':{'frmMain:wizardNext':'frmMain:wizardNext'} ,'actionUrl':'/trak/pages/admin/bizRuleMgmt.jsf?javax.portlet.faces.DirectLink=true'} );return false;" value="Next >>" style="float:right" type="button" /> </div> </div> </ui:composition>
Thank you for any help you can give me.
Hope I didn't give an overload of information to you.