I'm using Struts 2. Before forwarding to a page, I want to add a parameter (named "result"), if possible, to my request, so that in the resulting JSP, I can access that parameter. How do I do that? Below is the action I have created ...
You can try to add the value in the form of an attribute if that works for you ... That can be accomplished using the request object. In struts 1 it is available to you directly. In struts 2 you will have to use the ServletRequestAware interface to make that available in the method. refer ServletAware for further details
@Dave : David Newton is right you cant say struts and struts 2 to be the same. What code you have given is definately a struts 1 code not a struts 2. So next time be a little more precise coz things are very different between the 2.
There is one more work around for the same in struts 1 . (I am not sure how to implement in struts 2 ). You can create an instance of action forward object in the action and there when you assign the path to the jsp append the parameter using ?result=value ex: sample.jsp?result=value.
Though not a very neat way of doing things but a plausible alternative if qdding a parameter is a compulsary requirement.