While that is true, other than in the case of blank forms, isn't it true that one 
rarely depends on Struts to auto-generate the form bean?  If you are presenting data, 
the form is pre-populated with such data.  This data is typically derived by an 
earlier action -- mediated by a business delegate.  

Say you have action-1 which is invoked when a page-1 is submitted.  It does sundry 
business functions which includes getting the data necessary for the next page, page-2 
say.  In order for page-2 to pick up this data, action-1 must know the 'name' 
attribute for the action-mapping corresponding to page-2 and save the form-bean under 
this name in the appropriate scope.

Is there a way around this issue?

Sri
-----Original Message-----
From: Eddie Bush [mailto:ekbush@;swbell.net] 
Sent: Monday, November 11, 2002 3:00 PM
To: Struts Users Mailing List
Subject: Re: request.setAttribute() form confusion


You shouldn't ever have to create the form yourself if you:

- declare the form-bean in your config file
- use the name of the form you declared in the action mapping's "name" 
attribute

<form-bean name="myForm" ... />

...

<action path="/somePath" name="myForm" ... />

That should suffice.  What you should find is that the form is created 
for you.  Doing things as I mention simplifies you actions so that they 
can just expect the form to be there.  If the form is not there you will 
probably NPE.  That would indicate that you didn't create the 
association (by setting name="myForm") or Struts wasn't able to create 
the form for some odd reason.

Susan Bradeen wrote:

>Nevermind, answering my own question ...
>
>actions in the Struts examples don't use the second line of code, so 
>the
>answer is no, you don't need the two together.
>
>Susan
>
-- 
Eddie Bush




--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to