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
eclipse中的动态web项目未打开欢迎页面_Eclipse_Jsf_Tomcat_Facelets_Welcome File - Fatal编程技术网

eclipse中的动态web项目未打开欢迎页面

eclipse中的动态web项目未打开欢迎页面,eclipse,jsf,tomcat,facelets,welcome-file,Eclipse,Jsf,Tomcat,Facelets,Welcome File,我是eclipse的初学者,正在尝试一个简单的web项目,从hello world页面开始。 但是当我在tomcat服务器上运行项目时,这个url被触发,我得到HTTP 404错误:- 我的web.xml文件内容如下:- <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com

我是eclipse的初学者,正在尝试一个简单的web项目,从hello world页面开始。 但是当我在tomcat服务器上运行项目时,这个url被触发,我得到HTTP 404错误:-

我的web.xml文件内容如下:-

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
   <display-name>TestWeb</display-name>
   <welcome-file-list>
    <welcome-file>HelloWorld.xhtml</welcome-file>
    <welcome-file>HelloWorld.xhtml</welcome-file>
    <welcome-file>HelloWorld.xhtml</welcome-file>
    <welcome-file>HelloWorld.xhtml</welcome-file>
    <welcome-file>HelloWorld.xhtml</welcome-file>
    <welcome-file>HelloWorld.xhtml</welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>FacesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>FacesServlet</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>
</web-app> 

测试网
HelloWorld.xhtml
HelloWorld.xhtml
HelloWorld.xhtml
HelloWorld.xhtml
HelloWorld.xhtml
HelloWorld.xhtml
小脸蛋
javax.faces.webapp.FacesServlet
1.
小脸蛋
*.xhtml
状态保存方法:“客户端”或“服务器”(=默认值)。参见JSF规范2.5.2
javax.faces.STATE_保存方法
客户
javax.servlet.jsp.jstl.fmt.localizationContext
资源.应用
com.sun.faces.config.ConfigureListener

您必须检查
HelloWord.xhtml
的位置。正如您在
web.xml
中提到的,如果
HelloWord.xhtml
直接位于
WebContent
下,那么这很好,否则您将看到
Error-404

您可以尝试以下操作:使用/faces/*添加一个servlet映射标记节,并在欢迎文件列表标记中使用faces/HelloWorld.xhtml。“/faces/*”等不需要(也不使用)在现代jsf应用程序中。由于web.xml中现在没有到'/faces/*的映射,因此也不会引起问题。因此,不如询问/查询jsf版本等等。@Rin:请停止发布废话。最好尝试自己重现并解决问题,这样你就可以从经验中学习。