web.xml中的url-pattern和form 表单中的action是相同的。form 表单中的action声明的并不是servlet的名字
例:
<servlet>
<servlet-name>welcome</servlet-name>
<servlet-class>WelcomeYou</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>welcome</servlet-name>
<url-pattern>/ two </url-pattern>
</servlet-mapping>
<form action=" two " method="get">
请输入用户名:<input type="text" name="user">
例:
<servlet>
<servlet-name>welcome</servlet-name>
<servlet-class>WelcomeYou</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>welcome</servlet-name>
<url-pattern>/ two </url-pattern>
</servlet-mapping>
<form action=" two " method="get">
请输入用户名:<input type="text" name="user">
<input type="submit" value="提交">
</form>