我有一个同时有struts 1和struts 2的java webapp,里面有几个Struts2命名空间和Struts1模块。例如:
/public (Struts 1 module)
/accounting (Struts 2 namespace)
/auditing (Struts 2 namespace)
/receipts (Struts 1 modules)在我的web.xml中,Struts1和Struts2过滤器被明确映射到正确的名称空间/模块。例如,
<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>在我的Struts1区域中,我有一个让Struts1动作转发到Struts2动作的请求。我尝试了以下几种方法:
<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]我知道这可以通过Struts2过滤器映射网站的Struts1部分来解决,但这会给我们的特定网站带来问题,我希望避免这样做。
我还尝试了不使用该模块的操作:
<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那么还有什么我可以试一下的吗?如何让Struts1操作返回到Struts2操作的重定向?
发布于 2012-05-16 23:57:53
作为一种变通方法,在我的Struts操作中,我手动修改了response.sendRedirect以将用户发送到正确的页面,而不是将其映射到struts.xml文件中。
https://stackoverflow.com/questions/10603538
复制相似问题