Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


why do we typecast ActionForm into our plain java bean
class in Action class? What is the reason?

Answers were Sorted based on User's Feedback



why do we typecast ActionForm into our plain java bean class in Action class? What is the reason?..

Answer / kranthi kumar

As far as my knowledge is concerned.ActionForm is super
class and the bean class is sub class of ActionForm.So in
the action class it is downcasting that is performed and
downcasting in java needs an explict casting.

Is This Answer Correct ?    9 Yes 1 No

why do we typecast ActionForm into our plain java bean class in Action class? What is the reason?..

Answer / kiran

Action Form is basically sub class of Action Form Class.
When we want to assign super class with subclass object type
casting is required.

Is This Answer Correct ?    4 Yes 2 No

why do we typecast ActionForm into our plain java bean class in Action class? What is the reason?..

Answer / kartheeswari

ActionForm is a parent class for our userdefined formbean.
Ex. MyBean,means which has to be extended the ActionForm.

when we try to assign a parent class into subclass we need
downcasting.

Is This Answer Correct ?    1 Yes 0 No

why do we typecast ActionForm into our plain java bean class in Action class? What is the reason?..

Answer / supra

Use ActionForm to work on session data

In a Struts-based Web application, each ActionForm extends
org.apache.struts.action.ActionForm. These ActionForms
encapsulate page data and provide a validation framework to
validate request parameters.

Most Web applications maintain data in session to make them
available throughout the application. This best practice
addresses this Web application feature. It allows methods
toSession() and fromSession() to move session data to and
from the form data. Thus, it addresses session data
maintenance in a Web application.

To adhere to this practice, follow these steps:

Create an abstract class named BP3Form by extending
org.apache.struts.action.ActionForm.
In BP3Form, add methods with access modifiers as in public
abstract void toSession(SessionData sessionData) and void
fromSession(SessionData sessionData).
In every ActionForm, extend BP3Form and implement the
abstract methods in which the form data is transported to
and from the session.
The corresponding Action class may determine the order in
which these methods are called. For example, you could
invoke method toSession() on the ActionForm just before
actionForward is determined.
When to use this practice

This practice is most useful when session data is
maintained as a single object and/or every page manipulates
or uses session data.

Is This Answer Correct ?    1 Yes 5 No

Post New Answer

More Struts Interview Questions

What configuration changes are required to use Tiles in Struts?

0 Answers  


i have a log in web application .... i want restrict the user for particular no of users what is procedure to develop thus application

2 Answers  


Difference between struts and spring? Or why use spring, if you are already using struts?

0 Answers  


Which components are available using actioncontext map?

0 Answers  


What are the 5 constants of action interface?

0 Answers  


how will you view ur jsp page to the client by using properties file?

2 Answers   Wipro,


what is purpose cvs and vss in eclipse?

2 Answers  


How to upload struts file?

0 Answers  


How to handle exceptions in structs?

0 Answers  


What are Struts properties?

2 Answers   VI eTrans,


what is the purpose of load_on_startup entry in struts- config.xml?

8 Answers   Satyam,


What is the purpose of @validations annotation?

0 Answers  


Categories