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?
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.
Joined: May 22, 2001
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 .