aspose file tools*
The moose likes JSP and the fly likes URL rewriting and Struts  how-to Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "URL rewriting and Struts  how-to" Watch "URL rewriting and Struts  how-to" New topic
Author

URL rewriting and Struts how-to

Sanjay Deshpande
Ranch Hand

Joined: May 22, 2001
Posts: 111
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?
Michal Bienek
Greenhorn

Joined: Jun 17, 2002
Posts: 29
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.
Sanjay Deshpande
Ranch Hand

Joined: May 22, 2001
Posts: 111
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 .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URL rewriting and Struts how-to
 
Similar Threads
Passing value from one action to another action servlet
Passing object to Execute method
Request parameters
Struts:How to pass value from action class to jsp?
Passing parameter to view in DB2