This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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!
I agree. Here's the link:
subject: pre-populate form