GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  Struts
Go To First  |  Previous Question  |  Next Question 
 Struts  |  Question 34 of 103    Print  
Explain Struts Framework flow? and How JSP file can be processed?

  
Total Answers and Comments: 10 Last Update: May 25, 2006     Asked by: raghavendhark 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: sravishankarprasad
 

Struts Frame work 

This is what i understud by reading books and also tested successfully.

When a request is made to the Struts application, the first servlet Invoked is ActionServlet, which contains implementation for doGet(),doPost() methods.

Both these methods imvokes process() method which initialises the struts executions.  This process method invokes processPreproces() method of RequestProcessor class. This method returns boolean value. If it returns false then request professing will be terminated and error page will be desplayed.

else (in case of true) the request processor object will read the path associated with request Object and reads the struts-config.xml files to find the corresponding action element having same path as in the request.

 If it finds the action element then it reads the name of the action element whose value is the name of the form-bean, Then it populates the request object holded values to that FormBean class.

Then if the validate attribute of the action element is set to true then it also invokes the validate method on the FormBean.

If the validation goes fine then it will dispatch the exeuction process to Action class mapped as a value to type attribute of action element.

Once the request is processed i.e after compeletion of execution fo execute() method the response will be received by RequestProsessor class object i.e the ActionFroward class Object .

Based on this object the response page to  be displayed will be read from the forward sub element of the action element. and That  will be displayed at client side.

This is the internal execution of the complete struts application.

Any comments, suggetions accepted



Above answer was rated as good by the following members:
kumaras365
March 18, 2006 09:34:56   
kavithareddy        

RE: Explain Struts and Framework flow? and How JSP file ca...

what is struts and its frame work and also what serialisation and how many ways of serialisation is possible and another one is what is markup interface. and what is list and linkedflist in java


 
Is this answer useful? Yes | No
March 21, 2006 11:36:17   
sathish.vj        

RE: Explain Struts Framework flow? and How JSP file ca...
markup interface is like serialisation public interface kavithareddy{ } public class sathish impliments kavithareddy{ public static void main (String []ghfgcf){ } now sathish class instance will serialised (can reback the state of the object) . Struts is a MVC frame workV view(presentation logic) jspC Controler(select and forward to appropirate bean ) servletsM model(bussinus logic) bean
 
Is this answer useful? Yes | No
March 22, 2006 02:29:38   
Madhav Reddy        

RE: Explain Struts Framework flow? and How JSP file ca...
Struts frame work uses front controller design pattern for its centralized flow. First it matches the incoming path(*.do) with appropriate action in actionMapping of struts-config.xml. From this appropriate ActionForm is taken from fromBeans Tag and populates that frombean with incoming data and validate method is called for any validations required.If no validation errors are there then execute() method of Action class is called.Then the results are presented to the View.
 
Is this answer useful? Yes | No
March 22, 2006 02:48:16   
MadhavReddy Member Since: March 2006   Contribution: 1    

RE: Explain Struts Framework flow? and How JSP file ca...

Hi Kavitha

Struts follows MVC architecture and has many design patterns which it uses inside(ex Frontcontroller Value Objects).First it maps incoming path with path attribute of ActionMapping in struts-config.xml file and finds appropriate Action class for the request and maps the name attribute of ActionMapping with that of FormBeans tag. Then finds appropriate ActionForm for the request. Then it calls Validate() method of ActionForm if required.If there are no validation errors then Action class is called.Here business Logic starts and results are returned to the controller which presents in the appropriate View.

Acatually a lot of things happen behind the scene which will complicate the matter.


 
Is this answer useful? Yes | No
March 23, 2006 08:42:46   
Raveen Kumar G        

RE: Explain Struts Framework flow? and How JSP file ca...

MVC Model 2 Architecture is Struts.

1. Whenever a request comes to controller ActionServlet is Invoked which looks for ActioMapping in struts-config.xml

2. Action Servlet looks for existence of form bean corresponds to input request.

3. If not exist then instatinate the correpsonding ActionForm

4. ActionServlet Call the execute method of the corresponding Action Class

5. Which return ActionForward object with lookup value.

6. Action Servlet then do ActionMapping the forward to the Corresponding View according to the lookup value of ActionForward Class.

7. View Responds it to Client.

This is MVC 2 Architecture. This is Servlet Centric.


 
Is this answer useful? Yes | No
April 01, 2006 18:50:35   
pankaj_yadav Member Since: April 2006   Contribution: 1    

RE: Explain Struts Framework flow? and How JSP file ca...
Serialisation is basically mant for sustaining objects state by making it persistent. Serialisation is an empty interafce which is supposed to be implement by the class whose object are required to maintain their state. We can have customized serialisation by using Externilazable class. We ned to provide implmentation to Two of it's methods readExtern() and writeEntern.
 
Is this answer useful? Yes | No
April 11, 2006 23:31:32   
giri        

RE: Explain Struts Framework flow? and How JSP file ca...

i) All requests are passed through a controller servlet known as Action-servlet.

This is achieved by suitable 'url-mapping' in web.xml file.We have been doing 'URL-pattern' in Tomcat4 when using servlets.

And in j2ee webserver like Tomcat this facilitates 'centralized-declarative change management' by editing the concerned XML files without touching the source or class files of the servlets.or Struts Actions...

ii) All data submitted by user are sent to corresponding ActionForm.There are many actionforms but only one ActionServlet(because it is the controller).

iii) The ActionServlet examines the source of request and extracts the data from specified actionform and sends it to a specified instance of Action class.(as specified in struts-config.xml).

iv) The action object carries out the business logic either directly or through helper classes creates an instance of valuebean populates this bean with data and sends the bean to the View JSP.( an instance of ActionForward).

v) The important and distinctive feature of this arrangement is that the entire thing is done by 'Declarative-Management'.(and hence ActionMapping)

vi) Sometimes the data submitted has to be validated and error messages generated. (ActionErrors).

vii) We use tags in input side and also for output view.(The input form also belongs to 'view' category in MVC.)( Struts-tags)

viii) The details about the ActionServlet and other servlets if any in our application are given in web.xml

ix) Details about various action classes forms action-forwards etc are given in struts-config.xml


 
Is this answer useful? Yes | No
April 18, 2006 02:19:05   
avneesh1983 Member Since: April 2006   Contribution: 14    

RE: Explain Struts Framework flow? and How JSP file ca...
Struts frame work uses front controller design pattern for its centralized flow. First it matches the incoming path(*.do) with appropriate action in actionMapping of struts-config.xml. From this appropriate ActionForm is taken from fromBeans Tag and populates that frombean with incoming data and validate method is called for any validations required.If no validation errors are there then execute() method of Action class is called.Then the results are presented to the View.
 
Is this answer useful? Yes | No
April 28, 2006 03:16:55   
sravishankarprasad Member Since: April 2006   Contribution: 4    

RE: Explain Struts Framework flow? and How JSP file ca...

Struts Frame work

This is what i understud by reading books and also tested successfully.

When a request is made to the Struts application the first servlet Invoked is ActionServlet which contains implementation for doGet() doPost() methods.

Both these methods imvokes process() method which initialises the struts executions. This process method invokes processPreproces() method of RequestProcessor class. This method returns boolean value. If it returns false then request professing will be terminated and error page will be desplayed.

else (in case of true) the request processor object will read the path associated with request Object and reads the struts-config.xml files to find the corresponding action element having same path as in the request.

If it finds the action element then it reads the name of the action element whose value is the name of the form-bean Then it populates the request object holded values to that FormBean class.

Then if the validate attribute of the action element is set to true then it also invokes the validate method on the FormBean.

If the validation goes fine then it will dispatch the exeuction process to Action class mapped as a value to type attribute of action element.

Once the request is processed i.e after compeletion of execution fo execute() method the response will be received by RequestProsessor class object i.e the ActionFroward class Object .

Based on this object the response page to be displayed will be read from the forward sub element of the action element. and That will be displayed at client side.

This is the internal execution of the complete struts application.

Any comments suggetions accepted


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
May 25, 2006 03:25:24   
pradeep        

RE: Explain Struts Framework flow? and How JSP file ca...

Hi to all

As Madhav specified

(Struts follows MVC architecture and has many design patterns which it uses inside(ex Frontcontroller Value Objects). )

what are the other design patterns which it uses inside and can it be brief


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2010 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape