Why put static resources under the Web-inf?

Source: Internet
Author: User

Before I was in the first company, I encountered this problem, the little brother put JS file into the web-inf below, let leader scold a meal, not graduated from me, immediately endure, the heart can only silently flow of tears, said: "Sorry, I was wrong!". Then the reason I did not understand, leader just said can not put, put it can not load. So the younger brother had to do, did not ask reason, only know web-inf can only put static resources, JS file can not put.

Today in the group, I saw someone asking this question, so I decided to sum up a little bit, for the programmer of us, make a little contribution. (Big God, please detour)

  1. Security: Static resources in the Web-inf, the client access is not available, the server can access, that is, other people can not string change your code.

  2. To make it easier for spring to map for you: The configuration file will have configuration information for static resources.

  3. If you want to access the files directly in the page, you must map the files you want to access through the Web. xml file to access them.

Summary: In fact, is a sentence: "Security."

Why put static resources under the 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: 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.