mangusbrother
mangusbrother

Reputation: 4156

tomcat welcome page in jsf using template

I have a jsf project

and my pages are all referencing a template.xhtml

currently i have the following in the web.xml

<welcome-file-list>
    <welcome-file>/pages/home/index.xhtml</welcome-file>
</welcome-file-list>

when i try to access the root directory now it shows me some content from that page as jsf code (not rendered) but everything from within the template vanished as well. It just shows the title and 2 lines of code.

All help appreciated

Upvotes: 0

Views: 317

Answers (2)

mangusbrother
mangusbrother

Reputation: 4156

solved it added the following in the web.xml

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>

and created the following index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="refresh" content="0; faces/pages/home/index.xhtml">
        <title>Insert title here</title>
    </head>
    <body>
    </body>
</html>

Upvotes: 0

Elias Dorneles
Elias Dorneles

Reputation: 23806

Check the url mapping for the Faces Servlet in your web.xml file, it's probably wrong.

A good one should be like the one at the JSF tag info page:

<servlet>
    <servlet-name>facesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>facesServlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
</servlet-mapping>

Upvotes: 2

Related Questions