JSP enters Jar package

Source: Internet
Author: User

Because in Servlet3.0, you can support the JSP file into the jar package, simply add the Meta-inf/resources folder in the Src/main/resources, and then write the corresponding JSP in it to access. Such as:

The project is a MAVEN jar project, and another project called WebTest, a Maven war project, relies on this jar project for this web project. Starting the War project, we can access the test.jsp page in the jar package via http://localhost:8080/webtest/test.jsp.

If in a SPRINGMVC environment, how to adjust it. First you need to look at the SPRINGMVC configuration file, such as:

Note that the configuration of the prefix:/web-inf/jsp/, that in the jar package, you need to adjust the directory structure you just can access, such as:

If the directories in the jar are not adjusted, SPRINGMVC will look for the corresponding JSP in the/web-inf/jsp directory. Once the directory structure is adjusted, test.jsp will be able to access it normally.

JSP enters Jar package

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.