The data you put into the request is lost after the request is finished. When you press the submit button a new request is created, thus your newly created MyForm is what you get in the action. There two options if you want to keep the "old" data from the previous instance of the MyForm object:
1. Put the MyForm object into the session (you can either change the scope on your action, or do it your self). Then, in the next action you would get the same form you put into the request earlier. At the end of the "saving" step, you can remove the form from the request to free up the memory. 2. Keep the form at the request scope and layout enough <input hidden fields to "forward" the data to the next action. When the submit occurs, struts will pick up all the fields and populate the new instance of MyForm before giving it to you. If you need an student_id field in order to update student information, then pass it as a hidden variable. Both of these tend to work equally well for what you are trying to do. I use option 1, since during the "load" stage the form is loaded with a lot more information than is actually "directly" modified by the user. For example, MyForm might contain a Collection of options to be used for a dropdown list on the MyForm.jsp view. So, if you use option 2, that data might be lost if the user makes a mistake and is reverted back to the MyForm.jsp or MyFormAction via the struts validate(...) and input= combination on the action. In my development, I found that I wanted to keep the "load" and "execute" of the form in the same action. So, I created a "custom" action which uses the parameter= attribute to determine what to do. Then for my MyFormLoad.do and MyFormExecute.do I use the same physical java class, but as different actions with different options. In other words, to signal a load and keep the form in the session I pass parameter="+load+keepForm", as a result loadForm(...) method is called in my action. When I need to execute the form, I pass parameter="+execute+removeForm", which performs executeForm(...) and then removes (clears) the form from the session. There are other methods for form control. Some of them include setting flags in the session to indicate that a load need not be performed anymore. Others use "immutable" form fields pattern. I have yet to find a "standard" method that would (cleanly) accommodate: 1. Custom non trivial form loading 2. Proper form validation 3. Clean method for separating user input fields from display fields This pattern seems to be working ok for me, so far, there are problems, such as the input= parameter points to a .jsp page and not to a formLoad.do (because that would re-set) the form with all user's input. Your mileage may vary. ------------- -AP_ See my profile at http://www.myprofiles.com/member/view.do?profileId=128 -----Original Message----- From: Roger Nell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 26, 2002 8:02 AM To: [EMAIL PROTECTED] Subject: Form processing work flow What is the pattern for processing a form? Given: MyForm extends ActionForm MyFomAction extends Action MyForm.jsp displays the form using Struts 1.1 beta 1. Prior to calling MyFormAction.execute(), a MyForm() object is created by struts. In 1.0.x I would create the form object here. The struts example app was modified to accomodate this change. 2. In MyFormAction.execute() I call the form's set methods to setup the form's properties. 3. I save the form in the request attributes 4. The form is displayed by MyForm.jsp 5. The user hits submit button. 6. MyForm.reset() is called on a newly created MyForm(). 7. MyForm set methods are called on the form in step #6 8. I see the MyForm saved to the request attributes in step #3. 9. Struts calls MyForm.execute() with the form created in step #6 The problem is that struts is not giving me back the Form object saved in the request attributes in step #3 after the submit. Instead I get a new form obbject that was created in step #6. I want the one saved in the request attributes because it contains information needed to save the form back to the database or for a multipage form. __________________________________________________ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards. http://movies.yahoo.com/ -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>