GeekInterview.com
Series: Subject: Topic:
Question: 96 of 179

What is struts flow? Explain in detail

Asked by: Interview Candidate | Asked on: Aug 4th, 2006
Showing Answers 1 - 8 of 8 Answers
niranjan

Answered On : Aug 8th, 2006

struts is a open source implementation of MVC design pattern to develop large scale web applications.Struts framework makes it easier to design realible,scalable web applications in java.Struts is not only thread safe but also thread dependent.It instantiates each action once and allows others to  be threaded through the original object.Struts reduces the for redundant jsp's.ActionForm stratagy reduces the need of sub class hierarchy.Struts is a light weight package.It consists of 5 core packages and 5 tag lig directories. 

  
Login to rate this answer.
Jangam

Answered On : Aug 14th, 2006

Struts Flow is a part of Apache Cocoon's Control Flow to Struts to allow complex workflow, like multi-form wizards, to be easily implemented using continuations-capable Javascript and eventually Java."

  
Login to rate this answer.
nitin

Answered On : Aug 27th, 2006

all the above answers are can be fitted in the "what is struts?"Struts is based on MVC architecuture. Flow of struts is as follows if my understanding of question is correct1. request comes.2. corrosponding action class will be searched in the struts.xml3. mapped form-bean will be populated with data.4. execute method of mapped action servlet will be executed and result will be mapped in struts.xml with tag.5. mapped jsp/html page with forward will be displayed.

Yes  1 User has rated as useful.
  
Login to rate this answer.
Pardeep Dureja

Answered On : Sep 15th, 2006

Struts Flow Control starts from ActionServlet, on receiving request ActionServlet Delegate request to Request Processor, it is request processor that finds appropriate formbean on the basis of request,populate formbean, do required validation and execute app. action based on request.Hope this will solve ur quest...Pardeep Dureja

  
Login to rate this answer.
Sankar

Answered On : Oct 15th, 2006

Hi,

If the client comes to the struts application then the flow of control will be..

1) The request received by hte ActionServlet which is the default Controller in Struts...

2)ActionServlet then call RequestProcesser.preProcess method to find the formbean,populate the value to it,validate the values..

3)Once the validating has finished,the ActionServlet's RequestProcesser.preProcess() method call Action class's execute method where the original business processing begins....

4)The action class process the method and reurns the result to ActionServlet.....

5)In returning the Action class provides the key to the corresponding ActionServlet to determine the reult acqiured fromprocessing will be diplayed...

6)The ActionServlet then display results to client using the key provided by the action class..

Hope You understand well..!!

Bye!

Yes  1 User has rated as useful.
  
Login to rate this answer.
uday.sakhre

Answered On : Mar 6th, 2009

View all answers by uday.sakhre

Struts is a open source frame work used for implementation for MVC design pattern on server side to create web application.

  
Login to rate this answer.
kanna_sp2000

Answered On : Oct 4th, 2010

View all answers by kanna_sp2000

1. A request comes in with a .do extension, the container maps it to the ActionServlet. 2. The ActionServlet acts like a front end controller and dispatches control to a RequestProcessor. 3. The RequestProcessor finds an action tag with a path attribute that matches the incoming request 4. Then the RequestProcessor looks for a form-bean tag that has a name attribute that matched the action tags name attribute. 5. RequestProcessor instantiates a FormBean of the of based on the type attribute 6. RequestProcessor calls populates the FormBeans fields from the incoming request, then calls its reset method, then its validate method 7. RequestProcessor instantiates an Action based on the action tags type attribute 8. RequestProcessor calls the action's execute method which returns an ActionForward. 9. The RequestProcessor finds a matching ActionForward first within the nested forward tags, then from within the global-forwards tag. Note: if the validate method returns an ActionMessage then the RequestProcessor forward the request to the resource specified in the action's input attribute

  
Login to rate this answer.
Prabhakar122

Answered On : Nov 4th, 2010

View all answers by Prabhakar122

 Struts Flow======== 1) When application server gets started,container loads the web.xml2) When first the request is made from a JSP/HTML/XSLT to the server with a particular URI(/something.do) the control first reaches Web.xml file.3) It checks the mapping for /something.do in web.xml and finds the ActionServlet and loads ActionServlet.......<servlet-name>action</servlet-name><servlet-class>org.apache.struts.action.ActionServlet</servlet-class>.....<servlet-mapping><servlet-name>action</servlet-name><url-pattern>*.do</url-pattern></servlet-mapping>4) As part of loading ActionServlet calls the init() as every other servlet does.(Note: ActionServlet extends HttpServlet only)......................<init-param><param-name>config</param-name><param-value>/WEB-INF/struts-config.xml</param-value></init-param>........................5) In init() it takes the init-parameters as struts-config.xml and loads the xml file.6) Then the ActionServlet calls the process() method of RequestProcessor class.7) process() method checks for the appropriate action in the action mapping for current request and maps the URI to the action in the struts-config.xml.8) Then it creates an object to ActionForm associated to that action.9) It then calls the setters and reset() methods in the form bean(Which extends ActionForm) corresponds to the mapped action.10) If the action tag in struts-config.xml contains validate "true" then the validate method is called.11) if any validation errors it return to view component (any jsp XSLT) which is specified as an attribute of input  "/error.jsp"12) if there are no validation errors ,it then search for execute method in the action class and executes it.13) execute method performs the bussinesslogic which you provide and returns with an ActionForward key.14) Now the returned key is searched in the mapped action which is specified as forward tag.15) It looks for the appropriate view component and performs the getters on that action form corresponding to this view component and loads the view page in the browser.Hope it helps....       - Prabhakar 

Yes  1 User has rated as useful.
  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.