This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "populating a form with dynamic action form" Watch "populating a form with dynamic action form" New topic

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 ???
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:
I agree. Here's the link:
subject: populating a form with dynamic action form
It's not a secret anymore!