Struts 2.3.4.1 AppEngine 1.7.3 freemarker com.google.appengine.tools.development.LocalResourceFileServlet

时间:2012-10-30 11:54:45

标签: google-app-engine struts2 freemarker

我在任何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>

1 个答案:

答案 0 :(得分:0)

在struts.properties上设置

struts.serve.static=true