Anand Raman wrote:

> Hi guys
>
> I noticed in the struts-example application a check to find whether the
> ActionForm "form" passed to the perform method of Action class is null or
> not.
>
> Is it really necesarry.. I am not able to come up with a situation like
> this.. According my knowldge a ActionForm is always populated before the
> perform method is called on the Action class..
>
> can anyone please enlighten this situation
>

It will be null if and only if you have not associated an input form with
this action.  Otherwise, an ActionForm will have been created and populated
if it didn't already exist.

Now, of course, since I wrote the entire app in this case, I *know* that the
configuration file is correct, and the null checks are not strictly
necessary.  On the other hand, if I was writing actions and someone else was
building struts-config.xml, I'd generally do a little defensive coding like
this to protect myself from configuration file mistakes ...

>
> Thanks for ur time
> Anand

Craig


Reply via email to