Java – how to include JSP files from different projects in my project

How do I include JSP files from different projects in my project?

<%@ include file="./common/webappfooter.jsp"%>

The above code does not work

Solution

This is only valid if another project is bundled in the style of the jar file in the / WEB-INF / lib folder of the main webapp project and the JSP file is placed in the / meta-inf / Resources folder of another project

So, if you have / meta-inf / resources / common / webappfooter. Com in another project JSP, the following include should do:

<jsp:include path="/common/webappfooter.jsp" />

If you use an IDE with a little self-respect, you can configure it to automatically bundle another project as a jar of / WEB-INF / lib of webapp project It's not clear what ide you're using, but in eclipse, add other projects as deployment assemblies to the properties of the main webapp project

In eclipse, to create a project with the correct folder structure, select the web fragment project wizard

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>