Yes, this is on the right track, but how do I create a DynaValidatorForm
before it is actually used inside a form?  I don't think you can cast down
like that.  I understand how it is created "after" I submit the form, but
not before I submit the form.

Jim Kennedy
IT Consultant
-----------------------------------------------------


----- Original Message -----
From: "Wendy Smoak" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>; "Jim
Kennedy" <[EMAIL PROTECTED]>
Sent: Thursday, December 18, 2003 6:23 PM
Subject: RE: DynaValidatorForm and setting initial value for the
html-el:text tag


> From: Jim Kennedy [mailto:[EMAIL PROTECTED]
> The values to prepopulate the form are in a bean.  However,
> value="${user.firstName}" inside my <html-el:text> tag does
> not allow newly entered values to stick.

I think the struts-example webapp has an example of using
BeanUtils.copyProperties to copy values from a bean into the form.
Search the archives for 'prepopulate' and you should find some examples.
In a nutshell, you need to set the properties of the form bean before
you forward to the JSP, (then avoid setting them again when the form is
submitted, otherwise you'll overwrite the user input).

I have this...
private void prepopulateForm( ... )
   {
         // copy properties from the DTO to the form
         if ( form != null && contact != null ) {
            DynaActionForm dvForm = (DynaActionForm) form;
            BeanUtils.copyProperties( dvForm, contact );
            //manually deal with prospectName since it's called
prospectNameOrId on the form
            dvForm.set( "prospectNameOrId", contact.getProspectName() );
         }
   }

--
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management


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



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

Reply via email to