Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.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
Java 在ExternalContext中找不到作为资源的pages/index.xhtml_Java_Spring_Jsf_Jsf 2 - Fatal编程技术网

Java 在ExternalContext中找不到作为资源的pages/index.xhtml

Java 在ExternalContext中找不到作为资源的pages/index.xhtml,java,spring,jsf,jsf-2,Java,Spring,Jsf,Jsf 2,我开发了一个简单的项目。我使用JSF+Spring框架。 我的JSF web应用程序显示以下错误: 在ExternalContext中找不到HTTP状态404-/pages/index.xhtml作为资源 我的目录结构: -src --main ---webapp ----WEB-INF -----pages ------index.xhtml My web.xml <!-- Spring Context Configuration' s Path definitio

我开发了一个简单的项目。我使用JSF+Spring框架。 我的JSF web应用程序显示以下错误:

在ExternalContext中找不到HTTP状态404-/pages/index.xhtml作为资源

我的目录结构:

-src

--main

---webapp

----WEB-INF

-----pages

------index.xhtml
My web.xml

     <!-- Spring Context Configuration' s Path definition -->
      <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>
      /WEB-INF/config/applicationContext.xml
      </param-value>
   </context-param>
    <!-- Add Support for Spring -->
    <listener>
        <listener-class>    org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>

    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>

    <!-- Welcome page -->
    <welcome-file-list>
        <welcome-file>pages/index.xhtml</welcome-file>
    </welcome-file-list>

    <!-- JSF Mapping -->
    <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>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>

上下文配置位置
/WEB-INF/config/applicationContext.xml
org.springframework.web.context.ContextLoaderListener
org.springframework.web.context.request.RequestContextListener
javax.faces.PROJECT_阶段
发展
pages/index.xhtml
Facesservlet
javax.faces.webapp.FacesServlet
1.
Facesservlet
/面孔/*
Facesservlet
*.xhtml

谢谢:)

将页面文件夹放在webapp文件夹中

/faces/*
替换为
*。xhtml
不起作用。