aspose file tools*
The moose likes Struts and the fly likes populating a form with dynamic action form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "populating a form with dynamic action form" Watch "populating a form with dynamic action form" New topic
Author

populating a form with dynamic action form

karl koch
Ranch Hand

Joined: May 25, 2001
Posts: 388
and hi again
i have an application where a user can create and update/edit an entry (sounds like rocket science huh )
i want to use the same form (the same JSP) for this. how can i prefill the text fields of the html form in the edit case ? (user gets a list of entries , opens one entry, clicks edit and gets to the same form that is used for creation of entries but the fields are prefilled with the values of the selected entry)
i use a dynamic action form object for gathering the input in the action that is called upon submit (and also for validation) since i dont want to create ActionForm classes for all my forms.
any help, advice, hints, readings ???
thanks
karl
David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
When you say the user clicks edit, what happens?
You should be able to create an instance of the form and the .set("field", value) method to set whatever values you want.
Here is a simple method I use to handle what you are asking:
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: populating a form with dynamic action form
 
Similar Threads
ValidatorActionForm Question?
Submit form text fields (group) with same name
Simple Command MVC webapp
Validation not working after clearing the form
Problem with using DynaValidatorForm, is it possible to do it??