File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes how to populate values in bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to populate values in bean" Watch "how to populate values in bean" New topic
Author

how to populate values in bean

rahul karwal
Ranch Hand

Joined: Oct 26, 2001
Posts: 73
Hi,
i have a link in my home.jsp called updateProfile.jsp, when the user clicks on it i am suppose to forward it to an action called /updateProfile.do, then in the execute method i gather all the info from UTIL class which interacts with D/B, so far i am able to do everything, now i want to populate all the info i have gathered in the actionform which is called ProfileForm, my first question is do i have to make a new instance of it? or i can cast it from the form attribute of the execute method?.
how to i put this form in the request? i mean which key will the struts controller will be looking for so that it populates it?

if anyone can give me a small working example that will be really appreciated.

thanks
aziz dhanani.
John Smith
Ranch Hand

Joined: Sep 02, 2004
Posts: 61
1. If I'm understanding you correctly no you don't need a new instance, dynamicly cast the form in your execute method and you're set

2. The form is automatically put on the request if you use the <form-bean> mapping in the struts config, the name of the form in this mapping is the name of the bean on the request and you can access it's properties like any other bean.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to populate values in bean