this example works by going through the action, so the
url you need to use must go through the action...

http://hostname/myAction.do  

do not go through:

http://hostname/myPage.jsp   # your Action will not execute


What also might catch you is that by going through the
action, it forces the the validate() method of the
Form bean to be called, so if your validate fails,
your action will never get a chance to run, which in this
case is bad because you haven't populated your view yet!

I've got some smarts in my Form by using a hidden field
so that the validate method knows what the user is doing
so as not to fail if the model data has not been populated yet.

So I might edit data with http://hostname/editUser.do?action='load'&id='jsmith'

and when clicking the save button on my page after editing, i
change the hidden text field named 'action' to be 'save'

In this way validate() knows to do something different in the
action='load' case as opposed to an action='save' case.

In the 'load' case, my required field may be only 'id' but in
the 'edit' case, i may have lots of required fields, 'firstName', 'ssn', etc...

-don

-----Original Message-----
From: Marcus Biel [mailto:Marcus.Biel@;bmw.de]
Sent: Thursday, November 07, 2002 6:18 AM
To: [EMAIL PROTECTED]
Subject: Re: Populating a Form from the Model before view


Your Action ... (){
        perform(...ActionForm form..) {
                ...
                ..
                .
                YourActionForm yourActionForm = (YourActionForm)form;
                ...
                ..
                .
                yourActionForm.setYourProperty(yourPropertyValue);
        }
}

[EMAIL PROTECTED] schrieb:
> 
> Hello,
> 
> Could someone point out the process in Struts in which a Form is poulated form the 
>model before being viewed.
> 
> Most of the examples for Struts assume the Form is origianlly populated from the 
>view. I looking for the **reverse solution**. The sort of workflow for editing data ?
> 
> Best Regards
> 
> Mark

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to