I've an action which has a result type of type "redirectAction" which invokes another action (same action class but another method.For example, addUser method calla openUserPage method of UserAction class.) The problem is, I need to pass parameters between the two actions. The only way to do this is by adding the parameters on the XML, or by creating a model propery of the action class with setters and getters methods and in struts.xml. This works perfectly but my problem is, I've dozens of request parameters which I need to complete my second action. I already have the parameters in a HashMap (which is also a property of the action class) which has all the needed parameters. The only way which works for me is to add each single parameter on this hashmap into the XML file, but this sounds very annoying and not professional.
My question is, how can I add these request parameters on the fly between the two actions? I've created an interceptor and tried placing it on bottom (and top) of the defaultstack, get the the request parameters hashmap of the action from the actionInvocation object, but any added parameters to this hashmap (except the ones which already exist on it) are not recognized by the target action (and the JSPs as well).
<package name="userActions" extends="struts-default" namespace="/user">
<action name="openUserPage" method="openUserPage" class="com.home.client.struts.actions.UserAction">
<!-- In this action and its result, I need to have access to all parameters passed in [b]paramsMap above. I need them in the URL-->[/b]
<result name="openUserPage" type="dispatcher">/pages/userPage.jsp</result>
<result name="error" type="dispatcher">/pages/error.jsp</result>
subject: Struts 2 - passing request parameters on the fly during redirectAction result type