It is common to see example Action class containing these:
But the point is, why check for a null form? Does that mean the Action class could receive a null ActionForm even under normal condition (assuming there is no error in the struts-config.xml and we've defined our ActionForm properly)? And what should we do if a null form is received?
I guess, If you define everything properly in struts-config.xml then, this if-condition is not needed. For example, if you try to print the form whether it is null or not, it will print the actionForm what ever you are passing in to the execute method.
Unless you do not intialize the ActionForm bean, it will not be null.
There is only one condition that I know of that would cause the form to be null and that is if you don't define a name attribute in your action mapping. Since multiple action mappings could point to the same action class, it is conceivable that the form could be null under some circumstances and not null under others.
This is a very unusual situation, though. If you always define a name attribute for your actions, I wouldn't bother checking for a null form every time.