posted 15 years ago
The first page of my app is /myapp/showOption, it has a drop-down list containg some dat that is retrieved from database. so in struts-config.xml I set
<action path="/showOption" type="...MyAction", name="myForm", input="show.jsp">
<forward name="success" path="/showOption"/>
</action>
The "myForm" maps to a Form class defined in <form-bean>
when user clicks "/showOption" link, it triggers "MyAction" class' "execute" method, it gets data from database and do the setting methods on the form, show.jsp displays the values in drop down list.
On "show.jsp", there is a "update" button, user can pick one item from the options list and clcik "update", it saves this new value into another table. so the button links another action "/updateOption". Now, my question is --
I create another mapping for "/updateOption"--
<action path="/updateOption" type="...UpdateAction", name="myForm", input="show.jsp">
<forward name="success" path="/showOption"/>
</action>
I want that, after clicks "update", it stays on the "show.jsp" page. Question is --
For "update" action, can I use the SAME action form for display action ? The display form has an attribute that is a List of values. But for "update" action, I just need to input the selected value to the action. If using the same form, how do I get the selected item in the "execute" method of "update" action class ?