1.when actionservelet execute.
2.when web.xml executes

Answer Posted / shaik baji

--------
1)The "web.xml" comes into the the picture when the
respective server is started. When the time of server is
starting the container will check the syntax and parse
the "web.xml" file.
2)The "web.xml" file is called as a deployment descripta
because it tells the server just what the application
contains that's it beyond of that it's doesn't do any thing.

ActionServlet:
--------------
1)ActionServlet is a predefined Servlet class which comes
along with struts framework.
2)When we implemented a struts based web application then
every request and response must go through the controller
(ActionServlet).
3)We can define our own ActionServlet class insted of using
the predefined ActionServlt class but in most of all cases
we will use only the predefined ActionServlet class.
4)We should configure the ActionServlet class in
the "web.xml" file like as followed

Example:
--------
<web-app>
<servlet>
<servlet-name>as</servlet-name>
<servlet-
class>org.apache.struts.action.ActionServlet</servlet-class>

<load-on-startup>1</load-on-startup>

<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-
config.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>as</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>

5)If we specified "<load-on-startup>" then
the "ActionServlet" class will load,instantiated and
initilized when the server or application started.
6)If we didn't specify "<load-on-startup>" then
the "ActionServlet" class will load,instantiated and
initialized when the first request comes.

Is This Answer Correct ?    21 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why we use struts over servlets?

528


What is struts-default package and what are it’s benefits?

583


Name some of the features of struts2?

573


What is the purpose of @emailvalidator annotation?

499


List some struts tag libraries?

564






How do I access token?

503


What is the difference in using Action interface and ActionSupport class for our action classes, which one you would prefer?

572


Which design pattern is implemented by Struts2 interceptors?

556


What is ognl?

602


What is struts?

587


What is interceptor struts2?

537


Why are struts tightly coupled?

593


Can a reducer dispatch an action?

503


What is interceptor? And life cycle methods of interceptor?

576


How struts2 supports internationalization?

658