1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc)
Java online test
JSP online test
ORACLE online test
Hibernate online test
Servlet online test
Struts online test
EJB online test
C online test
C++ online test
Aptitude online test

Q.Struts Flow In Depth?

Steps 1.
The central component of the Struts Controller is the ActionServlet. It is
a concrete class and extends the javax.servlet.HttpServlet. It performs
two important things.
On startup, its reads the Struts Configuration file and loads it into memory in
the init() method.
In the doGet() and doPost() methods, it intercepts HTTP request and
handles it appropriately.

In the web.xml



If the user types http://localhost:8080/App1/submitDetails.do in the
browser URL bar. Server will call ActionServlet class because in the url-pattern the mapping is
<url-pattern>*.do</url-pattern>. Any *.do will call ActionServlet class.
ActionServlet calls the process() method of RequestProcessor class

Step 2.
ActionServlet calls the process() method of RequestProcessor class.
The RequestProcessor first retrieves appropriate XML block for
the URL from struts-config.xml. This XML block is referred to as
ActionMapping in Struts terminology. In fact there is a class called
ActionMapping in org.apache.struts.action package.
ActionMapping is the class that does what its name says ? it holds the mapping
between a URL and Action.

A sample ActionMapping from struts-config.xml

<action path="/submitDetails"
<forward name="success"
<forward name="failure" path="error.jsp" />

Step 3.

The RequestProcessor looks up the configuration file for the URL
pattern /submitDetails. and finds the XML block (ActionMapping) shown above.
The type attribute tells Struts which Action class has to be instantiated.

Step 4.
The RequestProcessor instantiates the CustomerForm and puts
it in appropriate scope ? either session or request. The RequestProcessor
determines the appropriate scope by looking at the scope attribute in the same

Step 5.
Next, RequestProcessor iterates through the HTTP request parameters
and populates the CustomerForm properties of the same name as the HTTP
request parameters using Java Introspection.

Step 6.
Next, the RequestProcessor checks for the validate attribute in the
ActionMapping. If the validate is set to true, the RequestProcessor invokes
the validate() method on the CustomerForm instance. This is the method
where you can put all the html form data validations. If any error then
RequestProcessor checks for the input attribute in the ActionMapping
and forward to page mentioned in the input tag.
If no error in validate() method then continue.

Step 7.

The RequestProcessor instantiates the Action class specified in the
ActionMapping (CustomerAction) and invokes the execute() method on
the CustomerAction instance. The signature of the execute method is as
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception

The execute() method returns ActionForward.

ActionForward forward = mapping.findForward(?success?);
return forward. will forward to ThankYou.jsp.
ActionForward forward = mapping.findForward(failure);
return forward. will forward to error.jsp.

Online Practice Test

Java online test
JSP online test
ORACLE online test
Hibernate online test
Servlet online test
Struts online test
EJB online test
C online test
C++ online test
Aptitude online test

Reviews and Comments

PMP, CAPM, PMI is a registered certification mark of the Project Management Institute, Inc

Copyright © www.techfaq360.com 2016

About US | Contact US | Privacy Policy | Terms and Conditions  | Website disclaimer  | Cancellation and Refund Policy  | Shipping & Delivery Policy