I have a requirement that I need to get a request parameter from actionB
on execution of actionA
. You can see below that there is complex logic behind working out strB
in actionB
. I want to get the value of strB
in actionB
without having to repeat the complex logic. What's the best way to do that?
<action name="actionA"
class="com.mycompany.action.ActionA"
method="input">
<result name="input" type="tiles">page.actionA</result>
</action>
<action name="actionB"
class="com.mycompany.action.ActionB"
method="readFromCache">
<result name="input" type="tiles">page.actionB</result>
</action>
public class ActionA extends ActionSupport
private String strA = new String();
private String strB = new String();
public String input() throws Exception {
strA = "Hello";
// do something here to get strB from ActionB
strB = ...need help here...
return INPUT;
}
public String setStrA(String strA) throws Exception {
strA = strA;
}
public String getStrA() throws Exception {
return strA;
}
}
public class ActionB extends ActionSupport
private String strB = new String();
public String readFromCache() throws Exception {
strB = ...complex logic here...;
return INPUT;
}
public String setStrB(String strB) throws Exception {
strB = strB;
}
public String getStrB() throws Exception {
return strB;
}
}