Java WEB Application web.xml Configuration--servlet mapping configuration __java

Source: Internet
Author: User
Tags java web

In each Javaweb application, there is a web.xml configuration file that is configured with the mapping of the servlet in the Web application, and now focuses on some of the instructions in the <servlet-mapping> section.

All servlet mapping configurations are based on Web application ContextPath, for example: if the name of the Web application is CMIs, deployed on a local TOMCAT6 server, and the port is 8080, then the contextpath of the Web application is HTTP ://localhost:8080/cmis, the path can be obtained by Request.getcontextpath (), for example, <a href= "<%=request.getcontextpath ()%>/ ESCHAINSTUDIO.JNLP "> Process customization </a>, then click the hyperlink to link to HTTP://LOCALHOST:8080/CMIS/ESCHAINSTUDIO.JNLP, now, Look at the map of the servlet,

<servlet-mapping>
<servlet-name>studiojnlpservlet</servlet-name>
<url-pattern>/eschainstudio.jnlp</url-pattern>
</servlet-mapping>

Indicates that when the requested URL is http://localhost:8080/cmis/ ESCHAINSTUDIO.JNLP, it will go to the Studiojnlpservlet servlet for processing, visible, by default, in all of the servlet's mapped configurations, are already in the <url-pattern> In front of the contextpath, for example,

<servlet-mapping>
<servlet-name>CMISMvcServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

means that when the requested URL is Http://localhost:8080/cmis + any content +.do, it is processed in a servlet with the name Cmismvcservlet.

Analogy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.