Servlet , Servlet Mapping and Pattern the HTML
2011-09-11 22:00
267 查看
In the web.xml config file:
<servlet>
<servlet-name>Your Sevlet name</servlet-name>
<servlet-class>Your class </servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Your Sevlet name</servlet-name>
<url-pattern>/url</url-pattern>
</servlet-mapping>
In the HTML file:
<form method="post" action="url">
</form>
Note:
1: The servlet-name in the two tags must be the same !
2: The url must be started with the '/', it stands for the webApp root directory .
3: The url in the HTML file must be the same with in the web.xml, except the char '/'
For example:
If your web.xml file was :
<servlet-mapping>
<servlet-name>Your Sevlet name</servlet-name>
<url-pattern>/YangZhiYong1/YangZhiYong2/servlet</url-pattern> //The diretories is not limited.
</servlet-mapping>
so your HTML file must write as :
<form method="post" action="YangZhiYong1/YangZhiYong2/servlet">
</form>
<servlet>
<servlet-name>Your Sevlet name</servlet-name>
<servlet-class>Your class </servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Your Sevlet name</servlet-name>
<url-pattern>/url</url-pattern>
</servlet-mapping>
In the HTML file:
<form method="post" action="url">
</form>
Note:
1: The servlet-name in the two tags must be the same !
2: The url must be started with the '/', it stands for the webApp root directory .
3: The url in the HTML file must be the same with in the web.xml, except the char '/'
For example:
If your web.xml file was :
<servlet-mapping>
<servlet-name>Your Sevlet name</servlet-name>
<url-pattern>/YangZhiYong1/YangZhiYong2/servlet</url-pattern> //The diretories is not limited.
</servlet-mapping>
so your HTML file must write as :
<form method="post" action="YangZhiYong1/YangZhiYong2/servlet">
</form>
相关文章推荐
- The servlets named [X] and [Y] are both mapped to the url-pattern [/Z] which is not permitted
- The servlets named [UserExit] and [com.fxh.control.UserExit] are both mapped to the url-pattern [/Us
- J2EE的TOMCAT服务器报The servlets named [x] and [y] are both mapped to the url-pattern[z] which is not per
- Difference between / and /* in servlet mapping url pattern
- The servlets named [x] and [y] are both mapped to the url-pattern [/JServlet] which is not permitted
- The servlets named [A] and [B] are both mapped to the url-pattern [/servlet/]which is not permitted
- The servlets named [xxx] and [com.web.xxx] are both mapped to the url-pattern
- maven创建Web项目启动错误The servlets named [X] and [Y] are both mapped to the url-pattern [/DemoServlet]
- The servlets named [LoginCheckServlet] and [LoginCheckServlet] are both mapped to the url-pattern [/
- web.xml中servlet-mapping的url-pattern的配置
- Inversion of Control Containers and the Dependency Injection pattern
- Free On-the-Web HTML Validators and Link Checkers
- Methods GET and POST in HTML forms - what's the difference?
- Head First Design Pattern - 2 - A Subject and Observer spar over the right way to get state information to the Observer
- 关于控制反转IoC--Inversion of Control Containers and the Dependency Injection pattern
- Complexities with NHibernate, DataTransferObjects and the Assembler Pattern(Ben Scott's Blog)
- JSP和Servlet对中文的处理过程JSP and Servlet on the Chinese processing
- Double-checked locking and the Singleton pattern
- Inversion of Control Containers and the Dependency Injection pattern
- Inversion of Control Containers and the Dependency Injection pattern