In the past, each Servlet was added in web. xml. As the project progresses, the number of servlets is growing.
The web. xml file is full. There is a way to improve the situation of these uninteresting things.
Add the following Servlet configuration in web. xml:
- <servlet>
- <servlet-name>InvokerServlet servlet-name>
- <servlet-class>
- org.apache.catalina.servlets.InvokerServlet
- servlet-class>
- <init-param>
- <param-name>debug param-name>
- <param-value>0 param-value>
- init-param>
- <load-on-startup>-1 load-on-startup>
- servlet>
- <servlet-mapping>
- <servlet-name>InvokerServlet servlet-name>
- <url-pattern>/servlet/* url-pattern>
- servlet-mapping>
OK. Now, this Servlet configuration can be retained in web. xml to meet all Servlet calls. For example, to call the Servlet UserManagerService, write it in the page form as follows:
- <form name="f" method="post" action="/servlet/com.mashiguang.
servlet.UserManagerService">
- <input/>
- <submit/>
- form>
Note that the form action "/Servlet/" is followed by the full name of this Servletclass. The Servlet configuration is web. xml slimming.
- Servlet Engine installation
- Configure the Servlet Development Environment
- JSP Servlet call in tag Library
- Small issues encountered when learning Java Servlet
- Servlet sharing links in sessions