Hi,
I wanted to pass a parameter with my .do file in struts-config.xml, but
I am not successful in that. I specifically want <action
path="/submit.do?name="smith".........>. Is there a way I can use this
or is this not allowed in struts?
Manish Pandit - 14 Sep 2006 17:05 GMT
What you are trying to do is add request parameters externally.This is
not gonna work unless you have a query string.
I'd recommend using request scoped variables or have the URL on your
JSP carry a query string.
-cheers,
Manish
> Hi,
> I wanted to pass a parameter with my .do file in struts-config.xml, but
> I am not successful in that. I specifically want <action
> path="/submit.do?name="smith".........>. Is there a way I can use this
> or is this not allowed in struts?
Babu Kalakrishnan - 15 Sep 2006 13:59 GMT
> Hi,
> I wanted to pass a parameter with my .do file in struts-config.xml, but
> I am not successful in that. I specifically want <action
> path="/submit.do?name="smith".........>. Is there a way I can use this
> or is this not allowed in struts?
There's a way you can fake it if your application accesses these
parameters only through the ActionForm and not directly from the
request.
Add your custom parameter as the "parameter" attribute of your action
mapping in struts-config.xml. The reset() method of the ActionForm gets
called with the ActionMapping as an argument - so you can access this
value using mapping.getParameter(), and load it to the appropriate
variable in your ActionForm.
Of course you've to be aware that since the reset() method gets called
before the form is populated, if the request does contain a parameter by
the same name, it will overwrite the value that you had stored there
from within the reset method call.
BK