Eu sei que talvez essa dúvida seja um pouco boba, mas procurei igual a um condenado, e não achei um exemplo que soluciona-se o erro!!!
Vamos lá!!!
Eu estou desenvolvendo um aplicação web, com JSF e Hibernate, e eu criei uma página index.jsp:
<html>
<body>
<jsp:forward page="/main.faces" />
</body>
</html>
Que obviamente(eu acho hauhauahauahu) redireciona para a página “main.jsp”, ai que é o probleminha, quando eu acesso a url http://127.0.0.1:8080/appjsf/ ele da o seguinte erro:
java.lang.IllegalStateException: No FacesContext is available to process this request. This is most likely due to the request being sent to the wrong path.
Eu li sobre esse erro, e esse erro ocorre por varios motivos, mas aqui é pq eu tento acessar o index.jsp diretamente e não pelo contexto index.faces (esta mapeado dessa forma no web.xml ), mas como eu crio uma página que redirecione para a main.jsp(“main.faces”)
Segue o meu web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</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>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
</welcome-file-list>
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<include-prelude>/jsp/include/header.jspf</include-prelude>
<include-coda>/jsp/include/footer.jspf</include-coda>
<trim-directive-whitespaces>false</trim-directive-whitespaces>
</jsp-property-group>
</jsp-config>
</web-app>
Vaelw a atenção de todos!