How do you prefill data in a form
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Kiran_Vasu
Posted On:   Thursday, December 27, 2001 09:38 AM

We have a small application that allows users to register and update their contact information. If the information on the user already exists in the database then we want to prefill the form with the data on the edit info page.

Based on previous answers here we have the link calling an action which attempts to read the users info from the database and call appropriate setters on the matching action form . However our data is not prefilled. Is there something else we must do or a different approach?

Re: How do you prefill data in a form

Posted By:   Ted_Husted  
Posted On:   Monday, December 31, 2001 03:58 AM

If the Action that calls the setters on the form uses the
form-bean as the Action to which you submit, then it
should work just fine.


Be sure to use the form instance that is passed to the
Action's perform. You will have to cast it, but the controller
will create it.


In the Struts config, be sure that both Actions
specify exactly the same "name" property.


HTH -Ted

About | Sitemap | Contact