The difference between JSP pages placed under Webroot or Web-inf

Source: Internet
Author: User

<textarea spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none" tabindex="0" readonly=""></textarea>
We know that there are two ways to implement a page jump, one is through redirect, and the other is through the forward way. Redirect Mode of the jump, the system will open a new page to jump to the page, and forward way to jump, the system will be on the original page to open a page to jump. So files placed in the Web-inf directory are not allowed to be accessed using Redirect-mode jumps .
<Jsp:forward page="/web-inf/jsp/login.jsp" />

JSP is placed in the Webroot directory so that users can access directly, JSP placed in the Web-inf directory must be requested to access.  
so it's safe to put the JSP page under Web-inf.  

By setting a filter, files placed under Webroot can also be accessed without direct access.

Write a filter to implement the filter interface

General projects are all requirements of concealment, Only ask the customer to access the JSP page instead of directly through the request. If placed under Webroot, you must add a filter to block all access to *.jsp.

as long as the comparison: placed under the Webroot: advantages, clear program structure, easy to encode and maintain, disadvantages, to add filters. put under the Web-inf: advantages, no filters, disadvantages, disrupt the program structure, coding and maintenance trouble points.

Recommendedput it under the webroot .

The difference between JSP pages placed under Webroot or Web-inf

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: 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.