struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jakkampudi, ChandraseKhar" <>
Subject RE: ActionForm Defaults/Updates Question
Date Thu, 14 Feb 2002 22:27:50 GMT
I used a value object to prepopulate the form on initial access for
modification like 
<html:text property="userName" value="<%=userInfo.getUserName()%>"/>
<html:hidden property="userID" value="<%=userInfo.getUserID()%>"/>

as I mentioned in a previous post. Everything works fine except that the
userID which is a hidden field is not retained on returning to input page
either on failure of validatoin or other reasons.
User Info is my value object which has information about the user.

I am looking for validation of this approach and also to find out why the
hidden variables are lost. 


-----Original Message-----
From: Mark Woon [mailto:morpheus@SMI.Stanford.EDU]
Sent: Thursday, February 14, 2002 4:22 PM
To: Struts Users Mailing List
Subject: Re: ActionForm Defaults/Updates Question wrote:

> 1. What is the best way to load default values into an ActionForm bean
> will show up the first time a user visits the site and pulls up a jsp

You know, this question has come up a bunch of times, but I've never seen
good responses.

If I've got a form in which users enter contact information, the first time
user sees it, I'd like to set the default values for the form to whatever I
about the user.

Since I already have a User object, I would think that the best place to do
would be in the reset() method of the ActionForm, but there's no way to pass
ActionForm the User object (or any information that's not part of the form)!
the end, I've just grabbed the Form bean from the pageContext and called a
setUser() method so that the reset() method will have something to pull data

Am I missing something?  Is there a better way to do this?


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message