File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Elasticsearch in Action
this week in the
SwtichAction and forwardPattern attribute
Joined: Jan 28, 2004
Nov 07, 2005 16:04:00
I am trying to use
module and encounter some strange behaviour. I am using Struts v1.2.4. This is the first time I try using module and not sure if this is my error or bug related to Struts.
Since I am placing
under /WEB-INF, I also used this line in my module's struts-config.xml:
<controller forwardPattern="/WEB-INF$M$P" />
My understanding is this line supposing should affect ONLY how path= attribute of <forward> is resolved. However, it seems that it also affects SwitchAction's behaviour.
In my default struts-config.xml, I have this action:
<action path="/sf" type="com.lyl.SuccessAction"> <forward name="success" path="/switch.do?prefix=/synToken&page=/synForm.do" /> </action>
In my struts-config-synToken.xml, I have this line:
<controller locale="true" forwardPattern="/WEB-INF$M$P" />
But the browser displays this error when /sf.do is requested:
"message Invalid path /WEB-INF/synToken/synForm was requested"
The above line means that SwitchAction trying to forward to /WEB-INF/synToken/synForm.do instead of /synToken/synForm.do (with the extra /WEB-INF, perhaps erroneously added)
I changed the above controller to
<controller forwardPattern="$M$P" />
and SwitchAction is now able to forward to /synToken/synForm.do in the synToken module.
Are these normal behaviour of SwitchAction?
It is sorta covered in the
JavaRanch Style Guide
subject: SwtichAction and forwardPattern attribute
struts modules with JSPs in WEB-INF and public redirects
Spring MVC behaviour for Struts
what is the significance of SwitchAction in struts framework
Hide Module JSP pages under WEB-INF
How to Put JSP under WEB-INF
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015