2012-03-10 54 views
0

(基本的struts項目使用appfuse) - 當我配置web.xml然後建立&啓動服務器其只顯示空格。然後通過使用螢火蟲我檢查響應它的404錯誤,再次如果我刪除filterDispatcher(第二映射在下面)然後它顯示起始頁。什麼是錯的任何想法?struts filterdispatcher 404錯誤

<filter> 
    <filter-name>struts-cleanup</filter-name> 
    <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class> 
</filter> 
<filter> 
    <filter-name>struts</filter-name> 
    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> 
    <init-param> 
     <param-name>actionPackages</param-name> 
     <param-value>com.webapp.action</param-value> 
    </init-param> 
</filter> 
<filter-mapping> 
    <filter-name>struts-cleanup</filter-name> 
    <url-pattern>/*</url-pattern> 
    <dispatcher>REQUEST</dispatcher> 
    <dispatcher>FORWARD</dispatcher> 
</filter-mapping> 
<filter-mapping> 
    <filter-name>struts</filter-name> 
    <url-pattern>/*</url-pattern> 
    <dispatcher>REQUEST</dispatcher> 
    <dispatcher>FORWARD</dispatcher> 
</filter-mapping> 
+0

@您使用的是哪個版本的S2,以及如果您能夠使用'StrutsPrepareAndExecuteFilter' – 2012-03-12 05:56:34

回答

1

FilterDispactcher不推薦使用StrutsPrepareAndExecuteFilter。

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="2.5" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 
    <welcome-file-list> 
    <welcome-file>index.jsp</welcome-file> 
    </welcome-file-list> 
    <filter> 
    <filter-name>struts2</filter-name> 
    <filter-class> 
     org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter 
    </filter-class> 
    </filter> 
    <filter-mapping> 
    <filter-name>struts2</filter-name> 
    <url-pattern>/*</url-pattern> 
    </filter-mapping> 
</web-app> 

並且當您返回結果名稱爲null時,有可能獲得空白頁面。