Forums Register Login

URL rewriting and Struts how-to

+Pie Number of slices to send: Send
i want to pass a parameter to my foreward page like this
<a href="mypage.jsp?valid=1"/>
how do i do that using struts?
in struts-config.xml, how do i specify a parameter like that?
HOW CAN I PASS A PARAMETER DYNAMICALLY?
+Pie Number of slices to send: Send
There are many ways to send this kind of data over to your forwarded page. Your safest bet is to create an Action and add your data string to the request as an attribute, and then fetch it from your forwarded page. I say this is the safest since it uses the framework the way it's meant to be used.
There is no way to specify dynamic parameters like that in the struts-config.xml. If you did have an Action leading to your forwarded page, and you absolutely wanted this data to be a "parameter", you could get the forward mapping (i.e. mapping.getForward("success") and then create a new forward based on the returned ActionForward, from which you could append your data to the path, but again, you'd be forced to ensure that the format of your data conforms to a query string.
I'd recommend placing it as a request attribute.
+Pie Number of slices to send: Send
I am new to struts and do not know exactly how this can b implemented.
Can u plz write 2 lines of example code or illustrate more .
Evacuate the building! Here, take this tiny ad with you:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1953 times.
Similar Threads
Request parameters
Passing value from one action to another action servlet
Passing object to Execute method
Passing parameter to view in DB2
Struts:How to pass value from action class to jsp?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 02:33:18.