| Author |
why do we typecast ActionForm into our plain java bean class in Action class?
|
p hasini
Ranch Hand
Joined: Oct 24, 2009
Posts: 92
|
|
|
why do we typecast ActionForm into our plain java bean class in Action class? What is the reason.
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
Take a look at the API doc of ActionForm class.
Now I typical subclass of ActionForm that we create would look something like this
Now in your action class, if you don't cast ActionForm to LogicForm, then you won't be able to call getUsername or getPassword methods. So basically you can access only the methods of ActionForm class. So then what's the use of ActionForm if you can't access the properties that you created in the bean associated with your Action?? You won't be able to leverage the automatic request parameter transferring capability of Struts as you'll have to access request parameters from the HttpServletRequest object...
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
 |
|
|
subject: why do we typecast ActionForm into our plain java bean class in Action class?
|
|
|