struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendy Smoak <>
Subject RE: question about ActionForm parameter of Action.execute() metho d
Date Wed, 26 Mar 2003 18:14:06 GMT
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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message