5 Replies Latest reply on Feb 17, 2014 11:25 PM by sfcoy

    Welcome file does not work for *.jsf

    masummymesingh

      I am using wildfly 8 final/CR1  edition

       

      and doing a hello JSF2.2 app With CDI .

      when use .jsf extension app can not work. but when use .xhml extension , it works fine.

       

      same problem not exists in Wildfly Beta but wildfly 8 final /cr1 gives this error ...

       

      problem :

       

         http://localhost:8080/hello ------------------------------ NO works***

         @http://localhost:8080/hello/index.jsf -------------   it works fine

       

       

       

      index.xhtml

       

      <?xml version='1.0' encoding='UTF-8' ?>

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"

            xmlns:h="http://xmlns.jcp.org/jsf/html"

            xmlns:f="http://xmlns.jcp.org/jsf/core">

          <h:head>

         

          </h:head>

          <h:body>

       

              <h:form>

                 Name :  <h:inputText value="#{helloBean.name}"/><br></br>

                             <h:commandButton value="save" actionListener="#{helloBean.save()}"/>

              </h:form>

                </h:body>

      </html>

       

       

       

       

       

       

      web.xml file is :

       

      <?xml version="1.0" encoding="UTF-8"?>

      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">

        <display-name>helloJSF</display-name>

        <welcome-file-list>

       

          <welcome-file>index.jsf</welcome-file>

       

        </welcome-file-list>

        <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>

      </web-app>

       

       

       

      any one pls help me  ?

        • 1. Re: Welcome file does not work for *.jsf
          ctomc

          Configuring welcome file like:

           

          <welcome-file>faces/index.xhtml</welcome-file>

           

          should work properly.

           

           

          btw, you can remove faces servlet & its mapping from web.xml and just keep welcome files configuration.

          • 2. Re: Welcome file does not work for *.jsf
            masummymesingh

            i was modified my web.xml code and it is working but

             

            I have need .jsf extension instead of /faces/index.xhtml ..

             

             

            can you tell me how to use ................*..JSF extension 

             

            <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>*.xhtml</url-pattern>

                </servlet-mapping>

                <welcome-file-list>

                    <welcome-file>index.xhtml</welcome-file>

                </welcome-file-list>

            • 3. Re: Welcome file does not work for *.jsf
              ctomc

              you will achieve exactly the same thing as you want.

               

              /faces/<name of your resource>

               

              is special way for handling jsf urls

              • 4. Re: Welcome file does not work for *.jsf
                masummymesingh

                Hi Tomaz ,

                 

                I want to use    <url-pattern>*.jsf</url-pattern> . not    <url-pattern>*.xhtml</url-pattern> .

                 

                 

                http://localhost:8080/hello/login.jsf                ------------------- I want to use this pattern


                http://localhost:8080/hello/faces/login.xhtml ---------------- it is working but i do not use this pattern

                   

                • 5. Re: Re: Welcome file does not work for *.jsf
                  sfcoy

                  It looks like WFLY-2948 was created to address this.