Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JSF仅通过web.xml呈现_Jsf_Tomcat_Primefaces - Fatal编程技术网

JSF仅通过web.xml呈现

JSF仅通过web.xml呈现,jsf,tomcat,primefaces,Jsf,Tomcat,Primefaces,将JSF2.2与Tomcat7.0结合使用,尝试使用web.xml在服务器上运行我的项目,但我的JSF从未呈现。当通过tomcat上的RunAs运行我的index.xhtml文件时,jsf将毫无问题地显示出来。这是我的web.xhtml: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.

将JSF2.2与Tomcat7.0结合使用,尝试使用web.xml在服务器上运行我的项目,但我的JSF从未呈现。当通过tomcat上的RunAs运行我的index.xhtml文件时,jsf将毫无问题地显示出来。这是我的web.xhtml:

<?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"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
 http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>ProcessOrderNewGreg</display-name>

<context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
</context-param>
<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
</context-param>
<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>*.xhtml</url-pattern>
</servlet-mapping>
<context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF
Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
</context-param>
<context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
</context-param>
<listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<welcome-file-list>
    <welcome-file>ProcessOrderNewGreg/index.xhtml</welcome-file>
    <welcome-file>ProcessOrderNewGreg/index.xhtml/index.jsf</welcome-file>
    <welcome-file>ProcessOrderNewGreg/index.xhtml/index.htm</welcome-file>
    <welcome-file>ProcessOrderNewGreg/index.xhtml/index.jsp</welcome-file>
</welcome-file-list>
</web-app>    

通过将my web.xml文件设置为:

<?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"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>ProcessOrderNewGreg</display-name>
<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
</context-param>
<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>*.xhtml</url-pattern>
</servlet-mapping>
<listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
    <welcome-file>index.jsf</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

我能够呈现我所有的JSF组件。

没有呈现的页面,是否有.JSF作为后缀?例如http://localhost:8080/ProcessOrderNewGreg/example.jsf?Nope,它们都是.xhtml。但我能让我的部件正常工作。谢谢你的帮助!如果您曾经使用faces重定向,您可能会遇到麻烦,因为它们附加了.jsf。。。不管怎样,祝你好运@我不知道我怎么会错过url映射。我是sorry@rion18你建议我怎样做才能避免可能的麻烦?
<?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"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>ProcessOrderNewGreg</display-name>
<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
</context-param>
<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>*.xhtml</url-pattern>
</servlet-mapping>
<listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
    <welcome-file>index.jsf</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>