1: 出现此问题的原因是访问路径不正确:
http://localhost:8080/demojsf/index.jsp
javax.servlet.ServletException: Cannot find FacesContext
2:解决的方法是输入web.xml配置文件当中正确的Servlet映射关系
如:<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
访问路径则为:http://localhost:8080/demojsf/index.faces
http://localhost:8080/demojsf/index.jsp
javax.servlet.ServletException: Cannot find FacesContext
2:解决的方法是输入web.xml配置文件当中正确的Servlet映射关系
如:<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
访问路径则为:http://localhost:8080/demojsf/index.faces
本文介绍了一个关于JSF应用中访问路径配置错误的问题及其解决方案。主要原因是Servlet映射设置不当导致页面无法正常访问。文章给出了正确的web.xml配置示例,并指出了应当使用的正确访问路径。
2578





