Pessoal,
Estou fazendo meu primeiro exemplo utilizando jsf, e estou com um probleminha.
seguinte, estou conseguindo acessar a página jsf pela url http://localhost:8080/coreJavaServerFaces/com/capituloUm/index.jsf
porém, ela não passa para a página seguinte, quando se clica no h:commandButton, gera a seguinte exceção: Cannot find FacesContext.
Não está navegando, permenece na mesma página.
segue configuração do web.xml :
1. <?xml version="1.0" encoding="UTF-8"?>
2. <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
3. <display-name>coreJavaServerFaces</display-name>
4. <welcome-file-list>
5. <welcome-file>index.html</welcome-file>
6. <welcome-file>index.htm</welcome-file>
7. <welcome-file>index.jsp</welcome-file>
8. <welcome-file>default.html</welcome-file>
9. <welcome-file>default.htm</welcome-file>
10. <welcome-file>default.jsp</welcome-file>
11. </welcome-file-list>
12.
13. <servlet>
14. <servlet-name>Faces Servlet</servlet-name>
15. <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
16. <load-on-startup>1</load-on-startup>
17. </servlet>
18.
19. <servlet-mapping>
20. <servlet-name>Faces Servlet</servlet-name>
21. <url-pattern>*.jsf</url-pattern>
22. </servlet-mapping>
23. </web-app>
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>coreJavaServerFaces</display-name> <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>default.jsp</welcome-file> </welcome-file-list> <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> </web-app>
faces-config.xml :
1. <faces-config
2. xmlns="http://java.sun.com/xml/ns/javaee"
3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4. xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
5. version="1.2">
6.
7. <navigation-rule>
8. <from-view-id>/index.jsp</from-view-id>
9. <navigation-case>
10. <from-outcome>login</from-outcome>
11. <to-view-id>/welcome.jsp</to-view-id>
12. </navigation-case>
13. </navigation-rule>
14.
15. <managed-bean>
16. <managed-bean-name>user</managed-bean-name>
17. <managed-bean-class>com.capituloUm.UserBean</managed-bean-class>
18. <managed-bean-scope>session</managed-bean-scope>
19. </managed-bean>
20. </faces-config>