java.lang.RuntimeException: Cannot find FacesContext

此异常的发生为<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>


应予以注意

你可能感兴趣的:(java,jsp,xml,Web,servlet)