5 Replies Latest reply on Mar 4, 2012 4:48 AM by sfcoy

    welcome file doesn't work

    japochino1

      Hello

       

      My <welcome-file-list> entry doesn't work.

       

      In my web.xml I have:

       

      ...

      <welcome-file-list>

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

      </welcome-file-list>

      ...

       

      Any suggestions?

       

      Thanks!

        • 1. Re: welcome file doesn't work
          sfcoy

          What does the servlet mapping in your web.xm look like?

           

          If it looks like this:

           

          {code:xml}

          <servlet-mapping>

               <servlet-name>your-faces-servlet-name</servlet-name>

               <url-pattern>*.faces</url-pattern>

          </servlet-mapping>

          {code}

           

          then your welcome file entry should look like:

           

          {code:xml}<welcome-file>inicio.faces</welcome-file>{code}

          • 2. Re: welcome file doesn't work
            japochino1

            My web.xml:

             

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

                <session-config>

                    <session-timeout>30</session-timeout>

                </session-config>

                <welcome-file-list>

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

                </welcome-file-list>

             

            But it's not working

            • 3. Re: welcome file doesn't work
              sfcoy

              Presumably you either have a inicio.jsp or inicio.xhtml file?

               

              If that is the case then add an empty dummy file called inicio.jsf in the root of your application.

               

              The spec says that welcome file resources must physically exist (even though it may never actually use the physical file for rendering).

              • 4. Re: welcome file doesn't work
                japochino1

                I didn't have a inicio.jsf physically.

                 

                I have created it and now it's working.

                 

                Thank you!

                • 5. Re: welcome file doesn't work
                  sfcoy

                  It's a not very well known "trick".

                   

                  You will see countless examples that have a dummy html file that just contains a redirect header like:

                   

                  {code:xml}<meta http-equiv="Refresh" content= "0; URL=inicio.jsf"/>{code}

                   

                  I like my way better!