当我在任何 struts 页面上访问时,我都会收到这个错误,因为 appengine 没有找到这个静态文件:
我一直在用谷歌搜索,但一点运气都没有。
oct 30, 2012 12:24:32 PM com.google.appengine.tools.development.LocalResourceFileServlet doGet
WARNING: No file found for: /struts/xhtml/styles.css
oct 30, 2012 12:24:32 PM com.google.appengine.tools.development.LocalResourceFileServlet doGet
WARNING: No file found for: /struts/utils.js
oct 30, 2012 12:24:32 PM com.google.appengine.tools.development.LocalResourceFileServlet doGet
WARNING: No file found for: /struts/xhtml/validation.js
oct 30, 2012 12:24:33 PM com.google.appengine.tools.development.LocalResourceFileServlet doGet
WARNING: No file found for: /struts/utils.js
我的 web.xml 上有 struts 过滤器(看起来像这样):
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<!--
I've tried this option too!!!!
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/struts/*</url-pattern>
</filter-mapping>
-->
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
我的 appengine-web.xml 有静态文件目录:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>myapp</application>
<version>1</version>
<threadsafe>false</threadsafe>
<sessions-enabled>true</sessions-enabled>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
<!-- Static files -->
<static-files>
<include path="/css/*" />
<include path="/struts/*" />
<include path="/struts/xhtml/*" />
<include path="/js/*" />
</static-files>
</appengine-web-app>