3 Replies Latest reply on Jan 13, 2011 5:06 PM by putopuntocom

    javax.faces.DEFAULT_SUFFIX not working??

    putopuntocom

      Hi all,

      I've just started to make some test in order to upgrade to Jboss 6.

       

      I have made the JSF2 first example as is explained here: http://docs.jboss.org/jbossas/6/JSF_Guide/en-US/html_single/index.html

       

      And it's working perfectly.

       

      Now I'm trying to change the default extension for jsf from xhtml to jspx adding the followin context-param in web.xml.

       

      <context-param>

                          <param-name>javax.faces.DEFAULT_SUFFIX</param-name>

                          <param-value>.jspx</param-value>

      </context-param>

       

      Change the file extension from index.xhtml to index.jspx

       

      Stop and start the server and when refresh the browser... after a long wait I get the next exception:

       

      2011-01-13 17:14:43,984 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/tda].[FacesServlet]] (http-127.0.0.1-8080-1) Servlet.service() para servlet FacesServlet lanzó excepción: org.apache.jasper.JasperException: /index.jspx(5,41) Attribute "xmlns:h" must be declared for element type "html".

                at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) [:6.0.0.Final]

                at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) [:6.0.0.Final]

                at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88) [:6.0.0.Final]

                at org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:214) [:6.0.0.Final]

                at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:239) [:6.0.0.Final]

                at org.apache.jasper.compiler.ParserController.parseDirectives(ParserController.java:120) [:6.0.0.Final]

                at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:191) [:6.0.0.Final]

                at org.apache.jasper.compiler.Compiler.compile(Compiler.java:358) [:6.0.0.Final]

                at org.apache.jasper.compiler.Compiler.compile(Compiler.java:338) [:6.0.0.Final]

                at org.apache.jasper.compiler.Compiler.compile(Compiler.java:325) [:6.0.0.Final]

                at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:607) [:6.0.0.Final]

                at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312) [:6.0.0.Final]

                at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [:6.0.0.Final]

                at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [:6.0.0.Final]

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]

                at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [:6.0.0.Final]

                at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541) [:6.0.0.Final]

                at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479) [:6.0.0.Final]

                at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407) [:6.0.0.Final]

                at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:542) [:2.0.3-]

                at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:359) [:2.0.3-]

                at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:150) [:2.0.3-]

                at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:96) [:2.0.3-]

                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97) [:2.0.3-]

                at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135) [:2.0.3-]

                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:309) [:2.0.3-]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.0.0.Final]

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.Final]

                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final]

                at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]

                at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]

                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]

                at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]

                at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]

                at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.Final]

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.0.0.Final]

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.Final]

                at java.lang.Thread.run(Thread.java:619) [:1.6.0_14]

       

       

       

      I have tried different configurations in web.xml but it's not working.

       

      Any ideas???

      What's wrong?

       

      Thanks

        • 1. Re: javax.faces.DEFAULT_SUFFIX not working??
          ssilvert

          I'd recommend using Facelets instead, but if you really need to use jspx then you will have to convert the xhtml file to a jspx file.  The index.jspx file should look like this:

           

          <?xml version="1.0" encoding="UTF-8"?>
          
          <jsp:root version="2.2"
              xmlns:jsp="http://java.sun.com/JSP/Page"
              xmlns:c="http://java.sun.com/jsp/jstl/core"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html">
          
            <jsp:directive.page contentType="text/html"/>
          
            <html>
               <f:view>
                  <h:form id="form1">
                    <h:outputText value="Enter Your Name:"/>
                    <h:inputText id="name"/>
                    <h:commandButton value="Submit" />
                  </h:form>
                  <h:outputText rendered="#{not empty request.getParameter('form1:name')}" 
                                value=" Hello #{request.getParameter('form1:name')}"/>
               </f:view>
            </html>
          
          </jsp:root>
          
          • 2. Re: javax.faces.DEFAULT_SUFFIX not working??
            putopuntocom

            Thank you Stan...

            I'm using facelets. I just want to change the default extension from ".xhtml" to ".jspx".

            In Jboss 4.2.3 with JSF1.2 it works perfect. Just was needed to add the DEFAULT_SUFFIX context-param.

             

            I have tried with other non-standard extension: ".other".

            I have the file index.other with the content as is in the example.

            And the context-param:

            <context-param>

                                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>

                                <param-value>.other</param-value>

            </context-param>

             

            When going to index.faces I get the answer immediately without errors or stacktraces, but the facelet code is not converted to html.

             

            It seems to me that this parameter is not working as it was before.

             

            Thanks again

            • 3. Re: javax.faces.DEFAULT_SUFFIX not working??
              putopuntocom

              Got it!!!

              Adding this other param works as did with xhtml extension.

               

              <context-param>

              <param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>

              <param-value>*.jspx</param-value>

              </context-param>