GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  Struts
Go To First  |  Previous Question  |  Next Question 
 Struts  |  Question 3 of 102    Print  
Explain Struts navigation flow

  
Total Answers and Comments: 5 Last Update: May 04, 2006   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: satheesh kumar. sriramaneni
 

When we deploy our application in the server, at first the container reads the information from web.xml file.Here ActionServlet object will be created and init() of ActionServlet will be called.Here ActionServlet is the backbone to the whole application.

When client send a rewuest using .jsp extension , getters() and reset() of FormBean will be called. When client fill the form and press on submit button, then setters() and validate() will be called.
If the data is not valid ,then the form redirects to another page which is specified in struts-config.xml file. If the data is valid , then only Action class object will be created.

In Action class , have execute() which have return type of ActionForward. We can specify the business logic in Model and provide that object in execute().
After completion of business logic execution , then it forwards to another page ( either success or failure) , whichis specified in struts-config.xml file.



Above answer was rated as good by the following members:
pradeepkmr18, kishorewvs, staney, natarajanv30
March 23, 2005 05:53:04   #1  
Madhu        

RE: Explain Struts navigation flow
A client requests a path that matches the Action URI pattern.The container passes the request to the ActionServlet.If this is a modular application, the ActionServlet selects the appropriate module.The ActionServlet looks up the mapping for the path.If the mapping specifies a form bean, the ActionServlet sees if there is one already or creates one.If a form bean is in play, the ActionServlet resets and populates it from the HTTP request.If the mapping has the validate property set to true, it calls validate on the form bean.If it fails, the servlet forwards to the path specified by the input property and this control flow ends.If the mapping specifies an Action type, it is reused if it already exists or instantiated.The Action’s perform or execute method is called and passed the instantiated form bean (or null).The Action may populate the form bean, call business objects, and do whatever else is needed. The Action returns an ActionForward to the ActionServlet.If the ActionForward is to another Action URI, we begin again; otherwise, it’s off to a display page or some other resource. Most often, it is a JSP, in which case Jasper, or the equivalent (not Struts), renders the page.
 
Is this answer useful? Yes | No
September 04, 2005 17:20:20   #2  
pratyusha        

RE: Explain Struts navigation flow
Flow:: 
1) Action servlet gets the request.It initiates the servlet-config.xml and selects an appropriate page as per the mapping 
2)If the accessed file is .java it does the appropriate action and fwd it to the file specified in the strus-config.xml. If the accessed path is .jsp it invokes the action bean where in the validation for the user input is done,if it fails errors are displayed..if it succeeds the action servlet is kicked and does the steps in execute() method..and fwd it to the necessary page as in mappings.foward()

 
Is this answer useful? Yes | No
October 13, 2005 03:32:20   #3  
Rohit Ankushe        

RE: Explain Struts navigation flow

The Struts Flow is like this the very first request  comes to the Action servlet which the part of the Controller component of the MVC architeture , then the requets is disptachted to the request processor the request processor find the specified mapping url of the response in invoke the page.

The struts config.xml  use to define as the mapping from the pages.After finding the respective mapping the bean is populated if its their and the forward to the requested path.


 
Is this answer useful? Yes | No
March 27, 2006 04:05:22   #4  
vivekmishra2001 Member Since: March 2006   Contribution: 1    

RE: Explain Struts navigation flow

Actual flow

The struts framework are most flaxible and example of loose coupling component

1-web.xml->actionservlet

2-Actionservlet class call the RequestProcesser class which deside the appropriate action for perticular request.

3-struts-config

4-formbean & action class

5-perticular jsp


 
Is this answer useful? Yes | No
May 04, 2006 23:54:18   #5  
satheesh kumar. sriramaneni        

RE: Explain Struts navigation flow

When we deploy our application in the server, at first the container reads the information from web.xml file.Here ActionServlet object will be created and init() of ActionServlet will be called.Here ActionServlet is the backbone to the whole application.

When client send a rewuest using .jsp extension , getters() and reset() of FormBean will be called. When client fill the form and press on submit button, then setters() and validate() will be called.
If the data is not valid ,then the form redirects to another page which is specified in struts-config.xml file. If the data is valid , then only Action class object will be created.

In Action class , have execute() which have return type of ActionForward. We can specify the business logic in Model and provide that object in execute().
After completion of business logic execution , then it forwards to another page ( either success or failure) , whichis specified in struts-config.xml file.


 
Is this answer useful? Yes | NoAnswer is useful 4   Answer is not useful 0Overall Rating: +4    


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape