The Web Application Deployment Descriptor in Struts Framework
The Web Application Deployment Descriptor in Struts Framework
The Web Application Deployment Descriptor in Struts Framework is important part because The Struts-config.xml file location is specified by the config init parameter in web.xml file.
This web application gets a request with "/login.do. LoginAction class will be invoked.The web.xml file maps request that end in *.do to the Struts ActionServlet. Struts ActionServlet will invoke our action based on the path attribute of the action mapping. The ActionServlet will handle all requests that end in *.do.
WEb.xml file contain <load-on-startup> sub element that causes the ActionServlet to be loaded when the application is started.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<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>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>