why do we typecast ActionForm into out plain java bean
class in Action class?

Answers were Sorted based on User's Feedback



why do we typecast ActionForm into out plain java bean class in Action class?..

Answer / jagadeesh b.n

Bcoz as u all know, casting are of 2 types Upcast(implicit)
and Downcast(Explicit)in core java.....Upcasting means
converting lower datatype(int) to higher datatype(long) and
Downcast means its a viceversa of upcast...(long to int)...

As u know in struts ActionForm is a superclass where as ur
Java bean program is a simple class with private fields and
set/get methods for conversion of superclass to sublclass
we use typecasting in struts...

Is This Answer Correct ?    5 Yes 1 No

why do we typecast ActionForm into out plain java bean class in Action class?..

Answer / ravikiran(aptech mumbai)

Because The methods what we declared in a bean are not of
type ActionForm class type that's why we are type casting
and calling our getters and setters

Is This Answer Correct ?    3 Yes 2 No

why do we typecast ActionForm into out plain java bean class in Action class?..

Answer / santhoshkumar.shaik

ok here our our form data in ActionForm
that's y u shoud do down Type Cast
othere wise u can n't use

Is This Answer Correct ?    0 Yes 2 No

why do we typecast ActionForm into out plain java bean class in Action class?..

Answer / balaji

Bcoz this will tell that our form bean is an action form
bean which will refer to which action it is referred from
strutsconfig.xml file


10x
balaji

Is This Answer Correct ?    1 Yes 4 No

why do we typecast ActionForm into out plain java bean class in Action class?..

Answer / johndoe

Acctually not realy thinking you should ask that, i mean
well ask, the answer is: to use it's methods.

But to understand it i recomend reading something about
polymorphy which explains why we're casting the action-
form, hope i understood right.

Regards
Jan

Is This Answer Correct ?    2 Yes 7 No

Post New Answer

More Struts Interview Questions

i have 500 jsps in my application,and i have same forward name for each jsp,so it lokks in strutsconfig.xml,from 1 to 500,but i want send 498 page directly,how can i cingigure my application

2 Answers   TCS,


What does the term struts mean?

0 Answers  


State an example of struts configuration file as an action parameter for action servlet.

0 Answers  


I have 4 jsp pages .At last page we have a submit button when we click it it will store all jsps data which we provide will store into database. how we can make it possible

1 Answers   MNC,


What is the purpose of @action annotation?

0 Answers  






how you provide security in your banking project

1 Answers   IBM,


Please can you tell me ,where can we used the MVC other than web applications.

1 Answers  


Briefly tell the two kinds of form beans.

0 Answers  


Name some of the features of struts2?

0 Answers  


What is the difference between validation.xml and validator-rules.xml files in struts validation framework?

0 Answers  


Why was reload removed from struts (since 1.1)?

0 Answers  


Who makes the struts?

0 Answers  


Categories