So i should call my action bean to pre-populate the jsp form?

----Original Message Follows----
From: Keith Bacon <[EMAIL PROTECTED]>

I think you've missed the point of form beans.
On submission of an html form struts looks at the request parameters. If it 
can find a matching
set method in the form bean it calls it. ie. the form parms are copied into 
the form bean.

When you forward to a jsp with a form struts calls the get methods of the 
form bean to populate
the the matching form fields (that have been defined with struts tags).

You action class can deal with the form variables by calling the same 
get/set methods of the form
bean. This saves doing qqq = request.getParameter("qqq"); & testing for 
nulls etc.

That's the whole point of form beans - to manage form fields.

To get readonly data onto your jsp your action class should place it in the 
request where the jsp
can get at it easily.

Keith.





--- "Witt, Mike (OH35)" <[EMAIL PROTECTED]> wrote:
 > I'm new to struts also, but the way I have been doing it is to set up an
 > action and a form bean in the struts config.  The action code (or some 
other
 > bean that the action code uses) for getting the data from the database 
and
 > populating the form using something like
 > (MyForm)form.setField(theFieldData);
 >
 > Hope this helps.
 >
 > Mike
 >
 > -----Original Message-----
 > From: Daniel Jaffa [mailto:[EMAIL PROTECTED]]
 > Sent: Thursday, January 10, 2002 9:25 AM
 > To: [EMAIL PROTECTED]
 > Subject: Populating a Form with values
 >
 >
 > I am new to struts so be nice (But i have worked with jsp for 2 years).  
I
 > have a form that i need to populate a form with values from the database. 
  I
 >
 > pass the form a data_base id to the form but i now need the form to 
populate
 >
 > the formbean.  I know how to do this in jsp but i want to do the in the
 > struts way.
 >
 > _________________________________________________________________
 > MSN Photos is the easiest way to share and print your photos:
 > http://photos.msn.com/support/worldwide.aspx
 >
 >
 > --
 > 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]>
 >


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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



_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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

Reply via email to