我有一个网络应用程序。我正在使用JSF2框架。在谷歌应用引擎服务器上运行此项目时,我的问题开始了。
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
这部分web.xml文件没有给出正确的输出。当我输入localhost:8080时,找不到index.html页面。怎么了?请帮忙。完整的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_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>
Wildstar Technologies, LLC. Google AppEngine JSF 2.0 Template
</display-name>
<description>
Template JSF 2.0 application configured to run on the Google
AppEngine for Java.
</description>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>cupertino</param-value>
</context-param>
<context-param>
<param-name>com.ocpsoft.pretty.DEVELOPMENT</param-name>
<param-value>/WEB-INF/pretty-config.xml</param-value>
</context-param>
<servlet>
<display-name>Remote API Servlet</display-name>
<servlet-name>RemoteApiServlet</servlet-name>
<servlet-class>com.google.apphosting.utils.remoteapi.RemoteApiServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>RemoteApiServlet</servlet-name>
<url-pattern>/remote_api</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ShowImage</servlet-name>
<servlet-class>mucayufa.web.jsf2.ferizliAdmin.beans.ShowImage</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ShowImage</servlet-name>
<url-pattern>/show</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Upload</servlet-name>
<servlet-class>mucayufa.web.jsf2.ferizliAdmin.beans.UploadDocument</servlet-class>
</servlet>
<servlet>
<servlet-name>Serve</servlet-name>
<servlet-class>mucayufa.web.jsf2.ferizliAdmin.beans.Serve</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Upload</servlet-name>
<url-pattern>/upload</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Serve</servlet-name>
<url-pattern>/serve</url-pattern>
</servlet-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern><!--*/-->
</filter-mapping>
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/*</url-pattern><!--*/-->
</servlet-mapping>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern><!--*/-->
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- ***** Designate server-side state saving. ***** -->
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
<!-- Disable use of threading for single-threaded environments such as
the Google AppEngine. -->
<context-param>
<param-name>com.sun.faces.enableThreading</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<!-- ***** Load the JavaServer Faces Servlet ***** -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- ***** Load the JavaServer Faces Servlet ***** -->
<!-- Map these files with JSF -->
<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>*.jsf</url-pattern>
</servlet-mapping>
<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>
<!-- ***** Specify session timeout of thirty (30) minutes. ***** -->
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
答案 0 :(得分:1)
不确定这是否是您的问题,但我的经验是,有时在devmode下,找不到静态资源。
虽然在此声明“默认情况下,WAR中的所有文件都被视为静态文件和资源文件” https://developers.google.com/appengine/docs/java/config/appconfig#Static_Files_and_Resource_Files,我确实遇到过静态资源在开发模式下无法解决的情况,即使它们应该在生产中执行。
我的意思是说没有&lt;的映射。 include path =“**。html”/&gt;在appengine-web.xml中,例如html文件不被视为静态资源。
我会尝试一个明确的&lt;包括&GT;在appengine-web.xml中进行映射,并确保没有&lt;排除&GT;通配符路径可能会解析为该文件,因为开发服务器看起来不能很好地处理它。
答案 1 :(得分:-2)
我有
的条目<url-pattern>/</url-pattern>
在web.xml中。评论说它起作用了......