From: "Sagar Naik" <[EMAIL PROTECTED]>

I have to edit some data in the form.
So I have to load the text fields in the form with
some data values from a Database Table Record.
Can I do tht initializing the bean object and give it
to struts to display the values ?

Yes, though the answer comes from BeanUtils, not Struts itself. In your Action, before the JSP is displayed, (after you retrieve the bean with the database values,) you can call
  BeanUtils.copyProperties( destination, origin );
to copy the values over. If the property names match, and both objects conform to the JavaBeans spec (mostly for naming the get/set methods) then it will just work. If not, you may have to give BeanUtils some hints about what you want it to do.

If you search the archives for 'propulate form bean' you should find some good info. Also take a look at the mailreader-example app (in the 'webapps' directory of the 1.2.7 distribution) which has an example of pre-populating the form bean in EditRegistrationAction.

--
Wendy Smoak




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

Reply via email to