How can container will know this is a struts application?

Showing Answers 1 - 19 of 19 Answers

nitin

  • Aug 27th, 2006
 

in the web.xml you have to put the servlet entry(org.apache.struts.action.ActionServlet)  which is nothing but action servlet. So each request will be handled by action servlet and then it will be forwarded to assingned mapping. Mapping is all done in struts.xml. i think in this very good site people should contribute by putting good question

  Was this answer useful?  Yes

khan

  • Aug 31st, 2006
 

Hi, If Action servlet handle every reqest then, what about Action class ll do. What we have to tell, i think Action class forward the request. What is action class exactly.

  Was this answer useful?  Yes

skravipati

  • Sep 15th, 2006
 

Hello Everyone...ActionServlet is the controller, it juz controlls the whole application by sending request to ActionForm and ActionAction Class will handle only the bussiness logic....according to the BL the request is forwarded to respective .jspAny mistakes plz correct it...ThanxSatish...

  Was this answer useful?  Yes

sivaprasad

  • Sep 22nd, 2006
 

HI .. I will clearly explain about what ActionClass and What is Acton Servlet? Action Servlet: ------------------- Action Servlet is class that is a main controller, It is responsible for receiving all HTTP servlet request.It is available in struts frame work itself. Action Class: --------------------- Action is a class that can be used in controller layer where we are extend Action class for our own MyAction class to override execute method in control layer.Using execute method we can access request objects In web.xml we are configuring for only Action Servlet class only.That's why we are saying struts is front cotroller design pattern. All the request.passed through only one servlet.I think when alll request is processed through one sevlet then container knows this is a struts application.

  Was this answer useful?  Yes

kiran annam

  • Dec 6th, 2006
 

i can explain it to the point when ever a request is invoked the container will invoke the excute method of action servlet and checks for the web.xml for org.apache.struts.action.ActionServlet and it mapped to sturts-config.xml file and there we r giving path which ends with( .do)and with this it can recongise as an struts application.

  Was this answer useful?  Yes

Smita Patnaik

  • Jan 16th, 2007
 

web.xml is the file in which ActionServlet( which is the controller servlet for a Struts application) is defined.

web.xml will be read by container when we start the container.

So then itself the container will know that it is a struts application.

  Was this answer useful?  Yes

Salahuddin Munshi

  • Feb 4th, 2007
 

Container doesn't know about any thing. what ever is configured in application's web.xml it will take it as a configuration. We can configure our own MVC implmentation and front controller in application configuration (i.e. web.xml) instead of ActionServlet. Container only take ActionServlet as another servlet context mapping. once request come for that context (/*.do), container instantiate the ActionSerlet (struct servlet) if it's not already created. Then it will call serlet init method for initialization. In init method ActionServlet do all initialization work with the help of struct config.xml (multiple config file in case of moduler approache). And in service method of ActionServlet it will call execute method of specific action mapped class. That a brief info about life cycle. Container doesn't know about which application is strut application. all it know is a sevlet and context mapping. Hope I answer the question.

  Was this answer useful?  Yes

The control is forwarded from the container to struts controller when is reads an entry like :--

 <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
            <param-name>config</param-name>
            <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
</servlet>

<servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
</servlet-mapping>


I hope this made it clear.

Thanks,
Vinay

  Was this answer useful?  Yes

Here one thing i want to finalize i.e everything is working on servlet container only i.e we need only serlet container not sturts container .since when we deploy the application into the servlet container first it reads ActionServlet in that we write the code to take struts-config.xml and convert it into java object using digerster api. and the application is now in service state i.e when ever client sends the request to the server for particular page then first service method of ActionServlet is executed.

like this everything is in terms of jsp,servlet and java classes.
here servlet and jsp's are executed by servlet container internally it is having JVM.
and java action classes are executed by JVM of the server.

  Was this answer useful?  Yes

Give your answer:

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

 

Related Answered Questions

 

Related Open Questions