2012-05-15 40 views
0

我有一个Java web应用与两个支柱1和支柱2内部应用程序有几个Struts 2名中的命名空间和Struts 1模块。例如:Struts的1动作重定向到Struts 2的动作

/public (Struts 1 module) 
/accounting (Struts 2 namespace) 
/auditing (Struts 2 namespace) 
/receipts (Struts 1 modules) 

在我的web.xml中,Struts 1和2过滤器专门映射到正确的名称空间/模块。例如,

<filter-mapping> 
    <filter-name>struts2</filter-name> 
    <url-pattern>/accounting/*</url-pattern> 
</filter-mapping> 

<filter-mapping> 
    <filter-name>struts1</filter-name> 
    <url-pattern>/public/*</url-pattern> 
</filter-mapping> 

里面我的Struts 1个区,我必须有一个Struts 1的动作着一个Struts 2的动作的请求。我试过如下:

<action path="/myRedirect" forward="/checkAccountRecords.action" module="accounting" /> 

然而,这会导致以下堆栈跟踪:

The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location] 

我知道,这可以通过通过Struts 2的过滤器映射在Struts 1个部分网站的固定,但这会给我们的特定网站带来问题,我想避免这样做。

我也尝试了动作,而不模块:

<action path="/myRedirect" forward="/accounting/checkAccountRecords.action" /> 

我得到了如下因素的错误:

can't find /receipts/accounting/checkAccountRecords.action (file not found) 

我也尝试以下操作映射:

<action path="/myRedirect" forward="../accounting/checkAccountRecords.action" /> 

我以下错误:

Path ../accounting/checkAccountRecords.action does not start with a "/" character 

那么,还有什么事,我可以试试吗?如何获得Struts 1操作以将重定向返回到Struts 2操作?

回答

0

作为解决方法,在我的Struts操作中,我手动修改了response.sendRedirect以将用户发送到正确的页面,而不是将其映射到struts.xml文件中。