*.jsf extension problem

I am trying to create a simple jsf application.I have made the basic configurations in the web.xml and faces-config.xml.

Everything works ok if the extension of my files is *.jsp. When I change it to *.jsf I have a problem.

I have a start.jsf page with the following code:

<jsp:forward page="/index.jsf"/>

My web.xml is <web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<context-param>

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

<param-value>/WEB-INF/faces-config.xml</param-value>

</context-param>

<context-param>

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

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

</context-param>

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

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

</servlet-mapping>

<servlet-mapping>

<servlet-name>jsp</servlet-name>

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

</servlet-mapping>

<welcome-file-list>

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

</welcome-file-list>

</web-app>

If my start.jsf has a simple hello inside everything works ok. When I am adding the jsp:forward tag it says that it cannot find the Faces Context.

What I cannot understand is why I have to add <servlet-mapping>

<servlet-name>jsp</servlet-name>

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

</servlet-mapping>

in my web.xml? Since I am adding this one also?<servlet-mapping>

<servlet-name>Faces Servlet</servlet-name>

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

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

</servlet-mapping>

[2545 byte] By [juanitaJa] at [2007-11-26 15:08:45]
# 1

Hi,

You have made two mappings for the same url* .jsf.

<servlet-mapping>

<servlet-name>Faces Servlet</servlet-name>

// this ur first mapping.

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

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

</servlet-mapping>

<servlet-mapping>

<servlet-name>jsp</servlet-name>

// this is ur second mapping..

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

</servlet-mapping>

Try after removing the second mapping.

yds_smarta at 2007-7-8 8:59:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

ok I did that but my problem remains:

In my start.jsf I have the following code

<jsp:forward page="/index.jsf"/>

It goes in the index.jsf but I have jsf code and it cannot be parsed it says that it javax.servlet.jsp.JspException: Cannot find FacesContext

In order to parse jsf code the code in the start.jsf should be

<jsp:forward page="/index.faces"/>

?

The keyword faces is necessary for parsing jsf code?

I tried it but then it says The requested resource (/index*.jsf) is not available.

juanitaJa at 2007-7-8 8:59:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Change <servlet-mapping>

<servlet-name>Faces Servlet</servlet-name>

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

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

</servlet-mapping>

<servlet-mapping>

<servlet-name>jsp</servlet-name>

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

</servlet-mapping>

To<servlet-mapping>

<servlet-name>Faces Servlet</servlet-name>

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

</servlet-mapping>

then you can use index.jsf.

BalusCa at 2007-7-8 8:59:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

If I leave only the following code:

<servlet-name>Faces Servlet</servlet-name>

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

</servlet-mapping>

then the application never actually starts.The browser is stuck like it does not know what to do with the *.jsf page.

Any help?

juanitaJa at 2007-7-8 8:59:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...