You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Wendy Smoak <We...@asu.edu> on 2003/03/26 19:14:06 UTC

RE: question about ActionForm parameter of Action.execute() metho d

Kevin wrote:
> Can the ActionForm parameter of the Action.execute method be
> null?  Under what circumstances will it be null and when will
> it be not-null?

If there is no form bean associated with the action in struts-config.xml,
then the ActionForm parameter will be null.

> Is this described anywhere?

It's definitely been discussed here, did you find anything in the archives?

> In the struts-example source, some of the actions check the
> form parameter and will instantiate (and put it into scope) if
> it is null.  Is that something that has to be done?  Why doesn't
> Struts do the instantiation and putting into scope?

You don't have to do it, Struts will instantiate the form bean and place it
in scope as long as struts-config is correct.  The code could be removed
from struts-example and it would still work, but it's not hurting anything.
I agree it's a bit  confusing and have previously wished for some
explanatory comments near the code.  But I don't complain too loud since I
have not submitted a patch. :)

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management

RE: question about ActionForm parameter of Action.execute() metho d

Posted by Kevin HaleBoyes <kz...@yahoo.com>.
--- Wendy Smoak <We...@asu.edu> wrote:
> Kevin wrote:
> > Can the ActionForm parameter of the Action.execute method be
> > null?  Under what circumstances will it be null and when will
> > it be not-null?
> 
> If there is no form bean associated with the action in
> struts-config.xml,
> then the ActionForm parameter will be null.

And this association is done using the 'name' attribute of <action>
to refer to a <form-bean> element?

Thanks for your help,
Kevin.


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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