Juan,

I'll give you a few quick ideas and if you have trouble with particular
pieces of it you can write back with more detailed questions.

1) Use an html:link tag from the Struts html taglib to generate a link
to your action that includes information that identifies which user was
chosen (userID? e-mail? whatever your primary key is)

2) In the action load the correct bean using the identifying information
that will be given as a parameter to the action.

3) Then, still in the action use the BeanUtils methods to populate the
properties from your bean into the form object. This works really well
if the property names are identical between your model bean and your
form bean. This assumes that your loadUserIntoSessionAction is defined
to use your user form bean, which causes it to automatically create the
form bean object for you and provide it as an argument to your action.

4) Now forward to the jsp that actually displays the user information
for editing. Make sure that the action of the form is defined in
struts-config and refers to the same form as your
loadUserIntoSessionAction, that way your form bean will automatically be
preserved for you.

5) That's it, when you display your jsp form it should have all the
values prepopulated.

-----Original Message-----
From: Juan Alvarado (Struts List) [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 12, 2001 9:45 AM
To: Struts
Subject: Help with an action


Hello:

I have what some of you might think is a simple question. I have a page
that
displays me a list of users with links to each user's details. When a
link
is clicked the link sends a request to /loadUserIntoSessionAction. What
I
would like to do in that action is take the user's details which is
stored
in a bean and populate those values in the edit user form.

SO basically the user goes trough /loadUserIntoSessionAction there I
want to
populate my editUserForm which is of type
com.manduca.protrack.EditUserForm from the values in a bean called
UserBean
and then forward to the edit user page and have all the form fields
already
pre-populated.

If anyone can point me in the right direction, I would greatly
appreciated.

Thanks

**********************************************
Juan Alvarado
Internet Developer -- Manduca Management
(786)552-0504
[EMAIL PROTECTED]
AOL Instant Messenger: [EMAIL PROTECTED]


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to