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   To Refer this Site to Your Friends   Click Here
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
How to explain struts work flow
 Question Submitted By :: Swetha
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How to explain struts work flow
Answer
# 1
Struts work flow:
When user run the Struts Application
first of all controll goes in XML file and find the Action 
Servlet that is main controller class in Struts after that 
control goes in Struts-config.xml and find the Action, find 
the Form bean and execute the action if method execute 
successfully the forward the output at given JSP.
 
Is This Answer Correct ?    0 Yes 2 No
Mahmood Alam Siddiqui
 
  Re: How to explain struts work flow
Answer
# 2
struts work flow begins from jsp pages(when user first hit 
on the submit button),then UR request go and refer in 
struts-config.xml to confirm whether the corresponding  
action class entry has been put and also refer whether the 
corresponding Bean class entry has been put or not,
If the entry Has been identified then that Bean class 
should be populated and then corresponding action class 
also be populated finally ActionForward  instance goes to 
struts-config.xml(GLOBAL-FORWARD).This cyclic process taken 
place for all the request.
 
Is This Answer Correct ?    3 Yes 1 No
S..murugan
 
 
 
  Re: How to explain struts work flow
Answer
# 3
1) A request comes in from a Java Server Page into the
ActionServlet.
2) The ActionServlet having already read the
struts-config.xml file, knows which form bean
relates to this JSP, and delegates work to the validate
method of that form bean.
3) The form bean performs the validate method to determine
if all required fields have been entered, and performs
whatever other types of field validations that need to be
performed.
4) If any required field has not been entered, or any field
does not pass validation, the form bean generates
ActionErrors, and after checking all fields returns back to
the ActionServlet.
5) The ActionServlet checks the ActionErrors that were
returned from the form bean’s validate method to determine
if any errors have occurred. If errors have occurred, it
returns to the originating JSP displaying the appropriate
errors.
6) If no errors occurred in the validate method of the form
bean, the ActionServlet passes control to the appropriate
Action class.
7) The Action class performs any necessary business logic,
and then forwards to the next appropriate action (probably
another JSP).
 
Is This Answer Correct ?    2 Yes 0 No
Madhu
 
  Re: How to explain struts work flow
Answer
# 4
when client makes the request,the request goes to web.xml
files <url-pattern> tag from here it goes to <servlet> tags
<servlet-class> there ActionServlet is loaded into the jvm,
and it is instantiated,initialized with in its init method,
Now the responsibility of  actionServlet is to identify the
request processor,by using <inti-param> tag,after request
processor identified ,ActionServlet creates the instance of
the request processor,on that instance of request processor
calls the process(), as a result request reaches to the
requestprocessor.
 the next responsibility of requestprocessor is to identify
the Action,using the client requestd uri.if client requested
uri and struts-config's path attributes are same then it
checks for the name attribute,if name attribute is found the
it goes to the <form-bean>tag there it check,if found ,sees
whether the form bean instance is available in the request
scope or not ,if found it instance set the request parameter
values by calling setxxx methods.then request reaches to the
  Action. action returns the ActionForward object, using which 
<forward> tag forwards to the appropriate jsp.
 
Is This Answer Correct ?    1 Yes 0 No
Aleem
 
  Re: How to explain struts work flow
Answer
# 5
1) When a user submitted a jsp page. that page having 
(attribute of )action="login.do". the container will call 
to WEB.XML. in that web.xml thert is two section servlet 
And servlet mapping


2) In servlet mapping it find *.do in the url-pattern. if 
it found to take the name of servlet. and check the 
corresponding class. in the servlet section. that class is 
ActionServlet.
3) ActionServlet is the controller of Struts module 
architecture. in Action servlet having the service method. 
in that method we create RequestPrecessor class instance
4) Service(req,res)
RequestPrecessor rp = new RequestPrecessor();
5) We call a process method of RequestProcessor class 
through the instance rp.process(req,res)
6) In the request processor class have the process method 
with the parameter of req,res. then it has 1 if condition 
in this class. that condition return always true. because 
that is dummy method.
7)Inside that condition ther is 6 steps are processing 
a)Create a action mapping instance in the "Struts-
Config.xml". it will kept all details of the action mapping 
path, value, type forward, validation=true/false, input 
="*.jsp" etc these r created instance 
b)Then it will create Form class instance before it check 
the name of action mapping and form name are coincidence or 
not if it same it will create form instance
c)Then it will go to ActionMapping instace the ris mention 
or not the validate =true/fale if false it will not execute 
the this step else it will execute this step.
d) Then it will create action instance 
e) Next it will take four parameters of execute Method it 
will return ActionErrors instance. if it is not empty. it 
will go to error page other wise it will got to 
corresponding page. else if it is empty if will go further 
and display corresponding value of page in jsp view.This is 
struts flow.
 
Is This Answer Correct ?    4 Yes 0 No
Pradeep Kumar Simhadri
 

 
 
 
Other Struts Interview Questions
 
  Question Asked @ Answers
 
struts comes under which layer of three tire architecture in real time projects plz i need explaination? Infinite-Computer-Solutions1
who will run the execute method in struts? Wipro4
How do you customize ActionServlet? Ness-Technologies2
what is the difference between SAX Parser and DOM Parser??  2
wahts the diif between Mvc1 and Mvc2? Wipro3
project architechture in java IBM2
what is project architecture?give brief explanation about project architecture? CTS2
what is ForwardAction and IncludeAction in struts? Mind-Tree2
What are Struts properties? VI-eTrans2
What is the difference between RequestProcessor and RequestDispatcher? Ness-Technologies8
What is Request Dispatcher and What is reuest Processor??  1
what are componeents presents in Strutsconfig.xml? HCL2
multiple instances for action class is it possible iFlex5
what are tiles in struts? Wipro2
why do we typecast ActionForm into our plain java bean class in Action class? What is the reason?  4
how can u handle run time exceptions in struts and jsp plz explain briefly not single word answer? TCS2
why do we typecast ActionForm into out plain java bean class in Action class?  3
What is the DynaActionForm? How we implement the dynaactionform ? can u please tell me the way to implement? in understandable way? JBA-Infotech7
How to set email notification using struts.Plz give the example code? HCL1
In Struts Programming which is the controller,which is the model?  9
 
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