GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  Struts
Go To First  |  Previous Question  |  Next Question 
 Struts  |  Question 98 of 103    Print  
Struts ActionServlet
why do we have only one ActionServlet in Struts?
(Asked in Polaris Interview for Java Experienced people , on April 11, Chennai)



  
Total Answers and Comments: 5 Last Update: November 20, 2008     Asked by: khadarzone 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: CatchSandeepVaid
 
he Jakarta Struts Framework does not support configuring more than one Struts ActionServlet in the Web deployment descriptor. This limitation occurs because there is only one servlet context per Web application and the commons digester imports the Struts configuration into the servlet context. Struts stores the required information as attributes in the servlet context, and the information is retrieved by using globally defined key names. Struts will suffix these attribute names with the prefix of the Struts modules, so several Struts modules are supported in a single Web application, but multiple Struts applications are not.

http://publib.boulder.ibm.com/infocenter/wpdoc/v510/index.jsp?topic=/com.ibm.wp.ent.doc/wps/multi_struts.html

Above answer was rated as good by the following members:
babli2007, bharathtele
April 16, 2008 09:34:25   #1  
satheeshraja Member Since: December 2007   Contribution: 2    

RE: Struts ActionServlet
ActionServlet is like BackBone of our application we have done all actions(request & response) by using only one instance that is ActionServlet's Instance that is the main reason to go for MVC architecture no need to create more than one instance thats why we use only one ActionServlet for whole project.

In Previous Structure we should create new instance for each and every request in MVC no need.

Note of it "we have only one Backbone in our BODY"

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
May 18, 2008 07:08:15   #2  
jaquline.phoenix Member Since: May 2008   Contribution: 1    

RE: Struts ActionServlet
The ActionServlet is the Controller comonent that handle the client request and determines which Action class will process each received request. As in MVC2 architecture only one controller component should govern the flow of application -i mean when request is generated it should be served by action class and based on the outcome next view is selected (internally RequestDispatcher forward() method is used to choose next view). All business logic is executed by Action class so ActionServlet does not have such overhead that we need multiple instances .

What is ur take ?

 
Is this answer useful? Yes | No
June 09, 2008 10:03:24   #3  
ratheeshkn Member Since: June 2008   Contribution: 1    

RE: Struts ActionServlet
An action servlet is a servlet that is started by the servlet container of the web server in order to process the request.

The servlet receives a request fromt he action and asks the servlet container to pass the request to the forward's URL.

Its the primary component of the controller and it should be and instance or a sub class of org.apache.struts.action.ActionServlet.

 
Is this answer useful? Yes | No
June 18, 2008 11:03:02   #4  
CatchSandeepVaid Member Since: June 2008   Contribution: 1    

RE: Struts ActionServlet
he Jakarta Struts Framework does not support configuring more than one Struts ActionServlet in the Web deployment descriptor. This limitation occurs because there is only one servlet context per Web application and the commons digester imports the Struts configuration into the servlet context. Struts stores the required information as attributes in the servlet context and the information is retrieved by using globally defined key names. Struts will suffix these attribute names with the prefix of the Struts modules so several Struts modules are supported in a single Web application but multiple Struts applications are not.

http://publib.boulder.ibm.com/infocenter/wpdoc/v510/index.jsp?topic /com.ibm.wp.ent.doc/wps/multi_struts.html

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
November 20, 2008 05:32:58   #5  
pradeep_rmk Member Since: November 2008   Contribution: 1    

RE: Struts ActionServlet
If the question was why does we have only one instance of Action Servlet than the life cycle would give us some awnser. A servlet will be instatiated only once.
But for the current question why do we have only one ActionServlet I am not sure if it is rule for MVC.

 
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 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape