Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

populating a form with dynamic action form

 
karl koch
Ranch Hand
Posts: 388
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic