This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes pre-populate form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "pre-populate form" Watch "pre-populate form" New topic

pre-populate form

M Smith

Joined: Feb 26, 2004
Posts: 2
I have a number of links on the page - update email, change address. When the link is clicked I need to create a form (put in the request?)- pre-populate it with the user information so when the JSP is loaded the information is displayed for user to update. I think I need manually instantiate and pre-populate an
action form before forwarding to JSP.
Any suggestions would be greatly appreciated
Srikanth Shenoy
Ranch Hand

Joined: Jan 24, 2004
Posts: 184
You have to manually instantiate and prepopulate the ActionForm. There is no way around it. However you can use the BeanUtils.copyProperties() from Common BeanUtils package to reduce some of the burden of copying from source to the target.
-Srikanth Shenoy

Srikanth Shenoy
Author of Struts Survival Guide : Basics to Best Practices
M Smith

Joined: Feb 26, 2004
Posts: 2
Do you have a code example on how to do this correctly?
Thank you!
It is sorta covered in the JavaRanch Style Guide.
subject: pre-populate form
Similar Threads
Variable value attribute in jsp:setProperty
transfer Bean between JSP and backend
Dynamic forms and pages
how to do a survey app ???
poulate a form from the reset (good practice)?