`

java.lang.RuntimeException: Cannot find FacesContext

    博客分类:
  • JSF
阅读更多
此异常的发生为<url-pattern>问题

假定你的faces-config.xml中的相关路径配置如下
<servlet-mapping>
	<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>*.faces</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>/faces/*</url-pattern>
	</servlet-mapping>



则你的url:中的相关路径应为http://localhost:8080/FirstApp/one.faces

                         或                     http://localhost:8080/FirstApp/faces/one.jsp

	
        <context-param>
		<param-name>javax.faces.CONFIG_FILES</param-name>
		<param-value>/WEB-INF/faces-config.xml</param-value>
	
       </context-param>

 <listener>
	        <listener-class>
                  com.sun.faces.config.ConfigureListener
            </listener-class>
	</listener>


应予以注意
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics