以往每添加一个Servlet就要在web.xml里添加
<
servlet
>
< servlet-name > InvokerServletservlet-name>
< servlet-class >
org.apache.catalina.servlets.InvokerServlet
servlet-class>
< init-param >
< param-name > debugparam-name>
< param-value > 0param-value>
init-param>
< load-on-startup > -1load-on-startup>
servlet>
< servlet-mapping >
< servlet-name > InvokerServletservlet-name>
< url-pattern > /servlet/*url-pattern>
servlet-mapping>
< servlet-name > InvokerServletservlet-name>
< servlet-class >
org.apache.catalina.servlets.InvokerServlet
servlet-class>
< init-param >
< param-name > debugparam-name>
< param-value > 0param-value>
init-param>
< load-on-startup > -1load-on-startup>
servlet>
< servlet-mapping >
< servlet-name > InvokerServletservlet-name>
< url-pattern > /servlet/*url-pattern>
servlet-mapping>
ok,现在web.xml里保留这一个Servlet配置就可以满足所有的Servlet调用了,比如调用UserManagerService这个Servlet,在页面表单里这样写:
<
form
name
="f"
method
="post"
action
="/servlet/com.mashiguang.
servlet.UserManagerService" >
< input />
< submit />
form>
servlet.UserManagerService" >
< input />
< submit />
form>
注意表单action"/Servlet/"后面是这个Servletclass的全名,以上是Servlet配置为web.xml瘦身.