File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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
jQuery in Action, 3rd edition