2 Replies Latest reply: Dec 8, 2011 6:54 AM by Avinash Munaga RSS

    JBoss-5.0.1 with facelets problems

    Benjamin Seyinbour Expert

      I wonder if anyone has notice problems using facelets with Jboss 5.0.1, because I am.

      Dev. environment:
      JBoss 5.0.1
      Eclipse 3.4.2 (aka Ganymede)
      Java 1.6.0_10
      Trinidad-1.2.11
      Tomahawk12-1.1.8
      facelets-1.1.15.B1
      JSF 1.2

      My *.xhml pages works fine but once I use facelets annotations e.g. ui:composition, ui:define, ui:decorate etc, I get 404 error. The error says:

      HTTP Status 404
      The requested resource (/web-context/pages/genre/new.faces) is not available.

      It is a mystery to me that the same page without facelets annotation would render fine but when the facelet annotation is added, it fails to renders.

      I have tried different facelet templates with different permutations in the web.xml but to no avail. Could some one take a look at my code and tell me what I am doing wrong, please.


      Code Excerpts
      --------------------------
      A: web.xml

      
      <context-param>
       <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
       <param-value>com.sun.facelets.FaceletViewHandler</param-value>
       </context-param>
      
      <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.xhtml</param-value>
      </context-param>
      
      <servlet-mapping>
       <servlet-name>faces</servlet-name>
       <url-pattern>*.xhtml</url-pattern> <---------When I use http://localhost:8080/web/pages/new.xhml
      </servlet-mapping>
      
      OR
      
      <servlet-mapping>
       <servlet-name>faces</servlet-name>
       <url-pattern>*.faces/url-pattern> <---------When I use http://localhost:8080/web/pages/new.faces
      </servlet-mapping>
      
      
      B: /genre/new.xhtml
      
      <?xml version='1.0' encoding='UTF-8'?>
      <trh:html
       xmlns:jsp="http://java.sun.com/JSP/Page"
       xmlns="http://www.w3.org/1999/xhtml"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:fn="http://java.sun.com/jsp/jstl/functions"
       xmlns:c="http://java.sun.com/jstl/core"
       xmlns:tr="http://myfaces.apache.org/trinidad"
       xmlns:trh="http://myfaces.apache.org/trinidad/html"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:t="http://myfaces.apache.org/tomahawk">
       <trh:body>
      <ui:composition template="/layout-template/layout.xhtml">
      <ui:define name="body">
      
      <tr:form id="genreForm">
      <tr:spacer height="15px" width="1px"></tr:spacer>
       <tr:panelBox
       binding="#{backing_newGenre.panelBox}"
       rendered="#{backing_newGenre.formBean.rendered}"
       background="medium"
       contentStyle="vertical-align:top;align:center;"
       id="panelBox"
       text="New #{backing_newGenre.formBean.localDisplayName}"
       inlineStyle="width:400px;">
       <tr:legend name="required"/>
      <tr:messages
       id="message"
       binding="#{backing_newGenre.messages}"
       globalOnly="true"/>
      <tr:legend name="required" styleClass="AFLegend"/>
      <tr:showDetailHeader
       id="genreShowDetailHeader"
       text="Genre Section"
       disclosed= "true" binding="#{backing_newGenre.genreShowDetailHeader}"
       shortDesc=""
       immediate ="true"
       size="3" messageType="error">
      <tr:panelFormLayout
       labelWidth="50%" fieldWidth="50%" maxColumns="1"
       id="genrePanelFormLayout"
       binding="#{backing_newGenre.genrePanelFormLayout}">
       <tr:panelLabelAndMessage labelStyle="vertical-align:middle;padding-top:3px;"
       label="#{backing_newGenre.formBean.nameLocalDisplayName}"
       binding="#{backing_newGenre.namePanelLabelAndMessage}"
       rendered="#{backing_newGenre.formBean.nameIsRendered}"
       showRequired="#{backing_newGenre.formBean.nameIsRequired}"
       id="namePanelLabelAndMessage"
       for="nameInputText">
      <tr:inputText id="nameInputText"
       inlineStyle="width: 150px;"
       value="#{backing_newGenre.formValue.name}"
       maximumLength="#{backing_newGenre.formBean.nameMaxLength}"
       shortDesc="#{backing_newGenre.formBean.nameShortDesc}"
       binding="#{backing_newGenre.nameInputText}"
       rendered="#{backing_newGenre.formBean.nameIsRendered}"
       required="#{backing_newGenre.formBean.nameIsRequired}"
       simple="true"
       readOnly="#{backing_newGenre.formBean.nameReadOnly}">
      </tr:inputText>
      </tr:panelLabelAndMessage>
       <tr:panelLabelAndMessage labelStyle="vertical-align:middle;padding-top:3px;"
       label="#{backing_newGenre.formBean.descriptionLocalDisplayName}"
       binding="#{backing_newGenre.descriptionPanelLabelAndMessage}"
       rendered="#{backing_newGenre.formBean.descriptionIsRendered}"
       showRequired="#{backing_newGenre.formBean.descriptionIsRequired}"
       id="descriptionPanelLabelAndMessage"
       for="descriptionInputText">
      <tr:inputText id="descriptionInputText"
       value="#{backing_newGenre.formValue.description}"
       rows="3"
       inlineStyle="width: 150px;"
       columns="#{backing_newGenre.formBean.descriptionDisplayWidth}"
       maximumLength="#{backing_newGenre.formBean.descriptionMaxLength}"
       shortDesc="#{backing_newGenre.formBean.descriptionShortDesc}"
       binding="#{backing_newGenre.descriptionInputText}"
       rendered="#{backing_newGenre.formBean.descriptionIsRendered}"
       required="#{backing_newGenre.formBean.descriptionIsRequired}"
       simple="true" wrap ="soft"
       readOnly="#{backing_newGenre.formBean.descriptionReadOnly}">
      </tr:inputText>
      </tr:panelLabelAndMessage>
      </tr:panelFormLayout>
      </tr:showDetailHeader>
      <tr:spacer height="5px" width="1px"></tr:spacer>
      <tr:separator/>
      <tr:panelLabelAndMessage label="">
      <tr:panelButtonBar
       binding="#{backing_newGenre.commandPanelButtonBar}"
       id="commandPanelButtonBar">
       <f:facet name="1">
       <tr:spacer width="1" height="1"/>
       </f:facet>
       <tr:commandButton textAndAccessKey="&Create"
       binding="#{backing_newGenre.createCommandButton}"
       id="createCommandButton"
       action="#{backing_newGenre.createButton_action}"
       disabled="false"/>
       <tr:commandButton textAndAccessKey="C&lear" immediate="true"
       binding="#{backing_newGenre.clearCommandButton}"
       id="clearCommandButton"
       action="#{backing_newGenre.clearButton_action}"
       disabled="false">
       <tr:setActionListener from="#{backing_newGenre.nullFormBean}" to="#{backing_newGenre.formBean}"/>
       </tr:commandButton>
      </tr:panelButtonBar>
      </tr:panelLabelAndMessage>
      <tr:spacer height="10px" width="1px"></tr:spacer>
      </tr:panelBox>
      <tr:spacer height="25px" width="1px"></tr:spacer>
      </tr:form>
      <!-- insert top-content here -->
      </ui:define>
      </ui:composition>
      
      </trh:body>
      </trh:html>
      
      
      
      C: /layout-template/layout.xhtml
      
      <?xml version='1.0' encoding='UTF-8'?>
      <!--
       <tr:document mode="strict" styleClass="body"
       xmlns:jsp="http://java.sun.com/JSP/Page"
       xmlns="http://www.w3.org/1999/xhtml"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:tr="http://myfaces.apache.org/trinidad"
       xmlns:trh="http://myfaces.apache.org/trinidad/html"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:t="http://myfaces.apache.org/tomahawk">
      
      <f:facet name="metaContainer">
       <tr:group>
       <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
       <meta http-equiv="content-language" content="en" />
       <meta http-equiv="pragma" content="no-cache" />
       <meta http-equiv="cache-control" content="max-age=0, no-cache, no-store, must-revalidate" />
       <meta http-equiv="expires" content="0" />
       <meta name="revisit-after" content="8 days" />
       <meta name="robots" content="index,nofollow" />
      </tr:group>
      </f:facet>
      <ui:insert name="header">Header</ui:insert>
      <ui:insert name="body">Body</ui:insert>
       <ui:insert name="footer">Footer</ui:insert>
      
      <ui:debug hotkey="d" rendered="true"/>
      </tr:document>
      
      
      
      As I said earlier when I remove the facelet annotations, the page is rendered
      
      In my web.war/WEB-INF/lib
      
      jstl-1.2.jar
      jsf-facelets.jar
      standard.jar
      trinidad-api-1.2.11.jar
      trinidad-impl-1.2.11.jar
      tomahawk12-1.1.8.jar
      facelets-1.1.15.B1.jar