ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Java J2EE  >>  Java Related  >>  Struts
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
why do we typecast ActionForm into our plain java bean 
class in Action class? What is the reason?
 Question Submitted By :: Kavitha.0205
I also faced this Question!!     Rank Answer Posted By  
 
  Re: why do we typecast ActionForm into our plain java bean class in Action class? What is the reason?
Answer
# 1
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 ?    0 Yes 0 No
Supra
 
  Re: why do we typecast ActionForm into our plain java bean class in Action class? What is the reason?
Answer
# 2
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 ?    1 Yes 0 No
Kranthi Kumar
 
 
 
  Re: why do we typecast ActionForm into our plain java bean class in Action class? What is the reason?
Answer
# 3
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 ?    0 Yes 0 No
Kiran
 
  Re: why do we typecast ActionForm into our plain java bean class in Action class? What is the reason?
Answer
# 4
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 ?    0 Yes 0 No
Kartheeswari
 

 
 
 
Other Struts Interview Questions
 
  Question Asked @ Answers
 
What is the differnce between 2-tier architecture and 3- tier architecture in java?  3
How to create validations?what are struts validation components?  1
If we close the browser,when the specific user session is active.Again if we open browse how to retrive it same user??what code i have to da??? TCS2
How do you know what to give for the "path " under in struts-config.xml ?  1
explain method overridding method overloding with examples? IBM3
how will you view ur jsp page to the client by using properties file? Wipro2
Is it possible to create mulitple instance of one Action Class in struts? Satyam7
what is the disadvantage of struts frame work?  7
what is the disadvantages of using DynaActionForm in struts framework? HCL4
what are the type of forward class in Struts? Wipro3
if u r using eclipse tool how can u debbaging u r application? plz explain with sample code Tech-Mahindra3
What is Hibernate?  3
In web.xml file instead of *.do can i write *.ibm, Specify with example IBM4
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 TCS2
what is tiles in struts?  4
How to pass runtime Parameter in Struts1.2?  1
what is ForwardAction and IncludeAction in struts? Mind-Tree2
how handle when client send multiple request at atime for multiple servlets servlets? IBM1
why do we typecast ActionForm into our plain java bean class in Action class? What is the reason?  4
what is project architecture?give brief explanation about project architecture? CTS2
 
For more Struts Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com