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应用中因路径配置不当导致的CannotfindFacesContext异常时的解决办法。通过正确设置web.xml中的Servlet映射关系,将访问路径更改为符合配置的形式,即可解决问题。
2578

被折叠的 条评论
为什么被折叠?



