:: Home Page            
 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  Contact Us     Login  |  Sign Up                      
Categories >> Software >> Java Related >> Java J2EE >> Struts


 Core Java interview questions  Core Java Interview Questions (1720)
 Advanced Java interview questions  Advanced Java Interview Questions (331)
 Swing interview questions  Swing Interview Questions (43)
 EJB interview questions  EJB Interview Questions (134)
 Servlets interview questions  Servlets Interview Questions (255)
 Struts interview questions  Struts Interview Questions (195)
 JDBC interview questions  JDBC Interview Questions (187)
 JMS interview questions  JMS Interview Questions (9)
 SunOne interview questions  SunOne Interview Questions (3)
 J2EE interview questions  J2EE Interview Questions (71)
 Weblogic interview questions  Weblogic Interview Questions (145)
 Websphere interview questions  Websphere Interview Questions (14)
 Java Networking interview questions  Java Networking Interview Questions (20)
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions (87)
life cycle of struts?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
  Re: life cycle of struts?
# 1
process of creating , invoking , destroying the servlet is
known as "life cycle of struts". here three methods are

1.init() :

Total intialization part of servlet ll be there in this .

2.service() :

Actual Bussiness code ll be there in this method

3.destroy() :

just destroying the servlet .
Is This Answer Correct ?    23 Yes 116 No
  Re: life cycle of struts?
# 2
In life cycle of struts there r several part are there

Action class
Is This Answer Correct ?    66 Yes 27 No
  Re: life cycle of struts?
# 3
There are many steps,

1. After getting the request from the client, the
ActionServlet invokes the goGet() or doPost() method, in
which there is a invokation of process() method.This method
desides the module.

2. Action servlet dispatches the request to RequestProcesor
class which does some core works of ActionServlet.Then
invokes the appropriate Action class.

3. Action class does main business logic and data accessing
(communicating with Moedl) thru execute() method and which
returns the ActionForward object.

4. In b/w the form field validations happens in form bean.

5. Depends upon the value of ActionForward object the view
is decided to display.(output)

4. Form bean is invoked for form field validation,
Is This Answer Correct ?    26 Yes 36 No
  Re: life cycle of struts?
# 4
The request is given to Action Servlet i.e; doGet or
ActionServlet with the help of request uri locates one of
the RequestProcessor and dispatch the request to
RequestProcessor i.e; process method on RequestProcessor is
called InRequestProcessor.

It processes content type.
processes Locale.
processes actionPath.
processes actionMapping.
processes formBean.
processes action.
Error handling.

After processing action(i.e; execute method) depending on
the results locate the path to view(with the help of
ActionMapping) and dispatch the request to the located
Is This Answer Correct ?    27 Yes 12 No
  Re: life cycle of struts?
# 5
When the Framework is loaded, it first loaded the Web.xml
file. Then from the Servlet tag of Web.xml, it identifies
the ActionServlet(or the Struts-Cofig.xml). Then from
welcome-file tag of Struts-Cofig.xml, it identifies the
first JSP page and runs it. Then when the request comes
through that jsp, from acion-mappings tag of Struts-
Cofig.xml it identifies the request, through path tag
(request name) and input tag (jsp name), through name tag
it identifies which bean is needed to access the data and
through type tag it identifies which Action should be
invoked. Then through the forward tag it identifies to
which jsp it has to forward the response.
Is This Answer Correct ?    60 Yes 8 No
Ayan Mukherjee
  Re: life cycle of struts?
# 6
Sorry in the previous answer I made one mistake, welcome-
file-list is located in web.xml not in Struts-cofig.xml
Is This Answer Correct ?    45 Yes 10 No
Ayan Mukherjee
  Re: life cycle of struts?
# 7
From Jsp page the controller looks into <form>tag with that
it enters into the web.xml, in web.xml it checks the <url-
pattern> tag, and it maps with <servlet-name> tag in
<servlet-mapping> tag, again it checks with <servlet-name>
which is there in <servlet> tag, it looks for corresponding
<servlet-class>.The Controller goes in strus-config.xml
from the it controller checks with the (req name) both in
<action> and <form-bean> if it is matching it will look
into the FormBean class.In FormBean class we have to write
setters and getters for the form input fields which are
there in Jsp page.Then the req is forwadard to Action
class. In Action class it will do some business logic based
on the requirement.
Is This Answer Correct ?    15 Yes 8 No
Manohar Reddy. Vummadi
  Re: life cycle of struts?
# 8
There is no life cycle for struts. If you have any proofs
just mention any standard books or official reference. don't
know why this kind of stupid questions are asked by interviewers
Is This Answer Correct ?    19 Yes 20 No
  Re: life cycle of struts?
# 9
Please find the below ural for struts life cycle digram.

suppose one form having name,age two fields and one submit
button. when ever enter the two fields and submit button.
the request goes to web.xml. the request check in the struts
config.file. the related form bean and action class will be
executing. then related redirect page.
Is This Answer Correct ?    5 Yes 6 No
  Re: life cycle of struts?
# 10
When any struts based web application loaded into server
initially it will load the ActionServlet class, due to
<load-on-startup> tag in web.xml. After instantiation it
will read struts-config.xml file, due to <init-param> tag in
web.xml. When anybody makes request to the respective web
application it will display the file which is mentioned in
<welcome-file-list> tag of web.xml file. When the view
page(.jsp) is displayed to the user internally the struts
framework (ActionServlet) will create an object for the form
bean class (which extends the ActionForm by calling zero
argument constructor(default construtor)) which is mapped
with the Action class path mentioned in .jsp file <html:form
action="/path"> b'coz ActionServlet already read the
information mentioned in struts-config.xml file. later it
will call the reset() and all the getter methods of the form
bean class. when the user fills the form and submit the
input, our form bean class again calls the default
constructor, reset(), all setter() methods, validate()
methods respectively. Validate method return ActionErrors
object. If the ActionErrors object contains any error
values(ActionError/ActionMessage values) then the
ActionServlet calls the input page mapped with respective
action class(<action input="/input.jps") that page will
display to the user with error messages. If ActionErrors
object is null(doesn't contains any ActionError/
ActionMessage) then the ActionServlet calls the execute()
method of the Action class which is bind with input request
(<action path="/path" type="package.OurActionClass"). the
execute() method will return ActionForward object. Depend on
the value, again the ActionServlet will call the respective
view(.jps page) as response and send it back to user. For
processing all the above steps ActionServlet will take the
help with RequestProcessor class. In this way one request
will be processed by the struts framework. And ActionServlet
will act as a front controllet for the application.
Is This Answer Correct ?    25 Yes 5 No
Vikram Naidu

Other Struts Interview Questions
  Question Asked @ Answers
Struts follows which design patterns? IGT 4
project architechture in java IBM 3
What happens when Two users requests for same action class? How the threads are controlled?   4
what is the difference between model1 and model2 architecture in struts?   3
what is the difference between *.do & /do.*/? So what is the diffenence btn extension mapping & path mapping.What is those difference in work effect? Wipro 6
How data transfered from one formbean to another formbean?   4
what are tiles in struts? Wipro 3
what is struts? why Struts? TCS 6
What is the DynaActionForm? How we implement the dynaactionform ? can u please tell me the way to implement? in understandable way? JBA-Infotech 8
what is the struts internal code? Wipro 1
Hi All thanks in advance, iam new to j2ee currently in my project we r using struts with hibernate can i have one sample application like CRUD application with code or any tutorials liks r ebooks plz....? IBM 1
For more Struts Interview Questions Click Here 

Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
Copyright 2013  All Rights Reserved.   ::