Easyui+springmvc--maven Project--web-inf secure Directory Access JSP

Source: Internet
Author: User

          each oneMaventhe directory structure of the project is mostly the same, and this directory structure is calledMavenStandard directory structure. BecauseMavenis the contract is better than the configuration, directly generated according to templateWebAppdirectory, so its defaultWebappis its publishing directory. We don't need any moreCopya copywebcontentdirectory, if you duplicate a copywebcontentdirectories that need to bePom.xmlinside configuration, TellMaven.

         &NBSP, based on maven convention is better than configuration, we use its default folder directory, All jsp web -inf springmvc The Returned interface is not found. What is this for?

WEB -inf directory is a protected directory, we put the background JSP The page is placed under its directory to enhance security and protect the source code. This directory is access control permissions, directly in the address bar to enter the page URL address is not accessible, prompting 404 error. You need to configure to access the.

The configuration is as follows:

xmlns:p= "http://www.springframework.org/schema/p" <!--access JSP page  add note driver  START--><MVC: Annotation-driven/><context:component-scan base-package= "Com.tgb.itoo.basic.controller" ></context: Component-scan><bean id= "Viewresolver"                 class= " Org.springframework.web.servlet.view.InternalResourceViewResolver "  p:prefix="/web-inf/jsp/"  p:suffix=" . jsp "/><!--Access JSP page  add note driver  end-->


        the configuration above is configuredSpringmvcView parser. SpringmvcUseViewresolveraccording toControllerreturned in theViewname is associated to the specificViewobject, usingViewobject to render the return value to produce the final view.

Summarize:

JSP page is placed in WEB -inf and the Webapp What are the pros and cons?

          put in web -inf The advantages of the directory are more secure, and the resources under it are not directly serviced by the customer and cannot be accessed directly jsp

The advantage of Webapp is that the structure is clear and the JSP page can be accessed directly . You can also add filters to achieve the JSP can not directly access the effect.



Easyui+springmvc--maven Project--web-inf secure Directory Access JSP

Related Article

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.