Configuring ActionServlet in web.xml File

There are two ways that ActionServlet can be configured to receive requests in web.xml.
·          First, ActionServlet can be configured using path mapping, as shown here: Path mapping routes to ActionServlet all requests that match a specified path.
 The default path is
/do/*. action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml 1 action /do/*

·         The second way to map requests to ActionServlet is to use extension mapping. Extension mapping maps to ActionServlet all requests with the specified extension.
The default extension to use is
*.do action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml 1 action *.do




<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.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>login.jsp</welcome-file>
  </welcome-file-list>
</web-app>

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More