(Stripping all the disclaimer mumbo jumbo that's longer than the message
:-)

On Wed, 23 May 2001 [EMAIL PROTECTED] wrote:

> 
> I have two actionForms one for person information 'personForm' and one for
> address 'addressForm'. I would like to have one JSP page to provide input
> form for both person information and address information. Currently one JSP
> and one ActionForm is easy to implement in Struts. But I am not sure what
> is the best implementation or options for one JSP page with two
> ActionForms.
> 

If the information is actually in separate forms, the simplest thing to do
is have them submit to separate actions that both declare the same page as
their "inputForm".  You'll probably need to keep the associated beans in
session scope so that the person information (for example) gets
redisplayed correctly when the address information's form bean returns a
validation error.

If the information is all in one form, but you really want to update two
different beans, Struts only helps you automatically with part of that.  A
couple of options to consider:

- Create a "combined" form bean that delegates its updates to the
  actual person and address beans underneath

- In your action, use the BeanUtils.populate() method (which is what
  Struts uses internally for automatic form bean population) yourself
  to populate the "other" bean.

> Any tips?
> 
> Regards
> Kelvin
> 

Craig


Reply via email to