Request forwarding and redirection of JSP servlet

Source: Internet
Author: User

 Previously, I was puzzled by the problem of the jump path between the servlet and servlet/jsp, and today I did a hands-on experiment and summarized the following:

The servlet is already a resource under the project root path, so when the servlet jumps, it can be added "/" on the jump path, or it can be added to the root path, with an absolute path.

Without "/", it means a relative path, because the servlet itself is already a resource under the root path, so it can be compared to any path in the project.

JSP jump (Commit also jump) to the servlet when add "/" or not, this time you have to look at the location of JSP, if the JSP is out of WebApp, (that is, the root directory) can not add, because the direct

Use a relative path to find the servlet below the original root path, and when the JSP is not in the following path, such as in a folder below the root path, you must add "/" as this

, you cannot directly find the servlet under the root path with a relative path, but you can also use the ". /"represents the parent directory and jumps to the servlet below the root path.

Summary: Although the previous said that the servlet jump can be added "/" can also be added, but the final practice is to add a better, as to not add what the problem, I am not very clear now.

____________nickgan.

2014-10-22

Request forwarding and redirection of JSP servlet

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.