3 Replies Latest reply on Apr 27, 2008 11:52 AM by jaikiran

    Sending default (welcome) page through Faces Servlet

    scheible

      I am currently evaluating JBoss for my department and am trying to transfer an existing project (currently deployed on WAS 6.1) to JBoss 4.2.2. One of the configurations that is fairly important to us is that the default page gets processed through the Faces Servlet. WAS 6.1 sends the welcome page through the Faces Servlet if the page name matches the appropriate mapping. JBoss does not seem to do the same.

      Example: http://localhost:8080/ -> http://localhost:8080/index.faces

      I have been hunting around for anything that might help but haven't managed to search for the right terms. Has anyone managed to accomplish this? I am trying to avoid having the page redirect the request elsewhere. Any pointers would be greatly appreciated.

      Thanks,
      Paul Scheible

        • 1. Re: Sending default (welcome) page through Faces Servlet
          jaikiran

          The default application on JBoss is configured in ROOT.war in %JBOSS_HOME%\server\default\deploy\jboss-web.deployer folder. You can make your application the default one, so that http://localhost:8080 points to your application. Follow this thread for more details:

          http://www.jboss.com/index.html?module=bb&op=viewtopic&t=121917

          • 2. Re: Sending default (welcome) page through Faces Servlet
            scheible

            Thank you for the information. It is useful although not quite what I was looking for.

            I know that many applications have a static welcome page. However, this application is configured to have a JSF welcome page. I can't figure out how to make the welcome page go through the Faces Servlet. Is this possible? I had considered possibly writing a filter that grabbed directory references from the client and appended the starting page to them. That seems like a lot of work but I suspect it would work. Alternatively, using an Apache proxy and the rewrite mod to do the same thing would probably work. In any case, if there is an easier method of do this, I prefer to use it.

            Thanks.

            • 3. Re: Sending default (welcome) page through Faces Servlet
              jaikiran

              In your web.xml, you can add a welcome page, like this:

              <?xml version="1.0" encoding="UTF-8"?>
              
              <web-app>
               <display-name>EJB3 Persistence</display-name>
              
               <servlet>
               <servlet-name>FacesServlet</servlet-name>
               <servlet-class>blah.blah.blah</servlet-class>
              
               </servlet>
              
              
               <servlet-mapping>
               <servlet-name>FacesServlet</servlet-name>
               <url-pattern>*.faces</url-pattern>
              
               </servlet-mapping>
              
               <welcome-file-list>
               <welcome-file>index.jsp</welcome-file>
              
               </welcome-file-list>
              </web-app>


              And then in the index.jsp (which will be at the root of the war), you can have this redirection:

              <html>
              <body>
              <%
              
               request.getRequestDispatcher("/dummy.faces").forward(request,response);
              
              %>
              </body>
              </html>