I'm migrating an existing Struts1 application to Struts2. I've kept the Actions and ActionForms classes hierarchy the same.
The Struts2 actions SuperAction extends from ActionSupport and has a ModerlDriven member variable SuperForm while SubAction extends from SuperAction and has a ModelDriven member variable SubForm.
Of course, SubForm is a subclass of SuperForm. Both SubAction and SuperAction have some action methods.
SubAction constructor is like:
public SubAction() {
subForm = new SubForm();
this.superForm(this.subForm);
}
Now, I've a scenario where I'm calling a SuperAction method from the mapping of SubAction like:
<package name="sub-pkg" namespace="/subns" extends="struts-default" strict-method-invocation="true">
<action name="subAction_*" method="{1}" class="com.company.SubAction">
<result name="showArchived" type="chain">subAction_list</result>
<result name="list">/jsps/list_logs.jsp</result>
<allowed-methods>list, showArchived</allowed-methods>
</action>
</package>
The SuperAction.showArchived() action method sets values in its member variable superForm.setLogMode() and returns String showArchived, which, as can be seen from the mapping, is chaining with the SubAction.list() action method.
This method makes use of SuperForm attribute logMode from its member variable subForm and returns String list to display the list_logs.jsp.
The action chaining is working but it's not passing SuperForm attribute value logMode, in this case of SuperAction method chain to SubAction method.
Any suggestions?
Update:
As a matter of fact, I found a general problem which is not specific to SuperClass/SubClass actions. It is occurring in general, in that using type="chain" is not working for model object in ModelDriven actions.
Therefore the chain doesn't re-populate the model properties at the end of the chain to the second action.
Any suggestions would be appreciated.