I've noticed that if the ActionForm's validate method returns ActionErrors
then the Action's perform() won't get called, and the user gets sent to the
JSP automagically.

(You can get around this... I've been trying to decide the best way... )

Seems like a great FAQ question since I've seen various flavors of this
question repeated on the list.  The kickstart FAQ is nice and "Ted's
Catalog" (http://husted.com/about/scaffolding/catalog.htm) is also good...
but I wish there was a better FAQ around... I don't feel I know/understand
enough yet to start one.  Is there one in progress?

+= Jeff Knee

> -----Original Message-----
> From: Joey Gibson [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 06, 2001 8:37 AM
> To: [EMAIL PROTECTED]
> Subject: Re: RE: Populating form in the action
> 
> 
> > The form passed in is a null because that Action is
> > called the first time I type in the URL (.do), not
> > after a form has been submited.
> > 
> > In other words, I would like to "pre-populate" the
> > form before displaying it.
> 
> If you have associated the action with a form in your 
> struts-config.xml, then any time your perform() method is 
> executed, there should be a form instance present. I use this 
> on my site. I do a GET on the action to, for example, edit my 
> account record. I fetch the user record, prepopulate the 
> form, and then forward to the jsp. Here's a code snippet:
> 
> public void perform(..., ActionForm form, ...)
> {
>  UserForm userForm = (UserForm) form;
> 
>  if (request.getMethod().equalsIgnoreCase("get"))
>  {
>    userForm.setName(...)
>    // ...
>  }
> }
> 
> --
> Sent via jApache.org
> 
> --
> 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