On Mon, 14 Mar 2005 11:53:12 -0800, Nic Werner <[EMAIL PROTECTED]> wrote:
> Reading the replies here and the Struts FAQ, everyone says "Create two
> actions, one to pre-populate the data, and the other to save that data"
> - So, the first action populates the data in the Execute() function,
> returns an ActionForward to the 'Edit' JSP. But in order for html:form
> to display that populated data, I have to refer to the first Action, not
> the second, barring me from submitting this data to the second page.

If both the "pre-populate" action and the "update" action have a
reference to the same ActionForm, you should be good to go.  (Just be
sure to set validate="false" on the "pre-populate" action.)

Here's the sequence of events:

1) The Struts RequestProcessor receives a request that it maps to prepopulate.do
2) It sees that prepopulate.do requires a "YourFormBean" object in
request scope, so it checks the request.
3) Since at this point, there is none, it creates a new instance of
the appropriate ActionForm subclass and saves it in the request
4) Your prepopulate action is called.  Since YourFormBean exists, all
you have to do is copy the appropriate properties from your model
layer into that object.
5) The prepopulate action returns a "success" forward, which points to
editYourFormBean.jsp
6) This JSP page has an <html:form/> tag that points to update.do. 
The form tag class consults the configuration classes and sees that
the form for that action is also of type "YourFormBean".  Since this
form bean already exists, the form fields are populated with those
values.

Does that help?

-- Jeff

-- 
Jeff Beal
Webmedx, Inc.
Pittsburgh, PA USA

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to