2012-03-10 133 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时,有可能获得空白页面。