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