如何将来自不同项目的JSP文件包含到我的项目中 [英] How do I include a JSP file from a different project into my project

查看:111
本文介绍了如何将来自不同项目的JSP文件包含到我的项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将来自不同项目的JSP文件包含到我的项目中?

How do I include a JSP file from a different project into my project?

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

上述代码不起作用。

推荐答案

仅当其他项目在 / WEB-中捆绑JAR文件的风格时才有效INF / lib 主webapp项目的文件夹,如果JSP文件又放在另一个项目的 / META-INF / resources 文件夹中。

This works only if the other project is bundled in flavor of a JAR file in /WEB-INF/lib folder of the main webapp project and if the JSP file is in turn placed in /META-INF/resources folder of the other project.

所以,如果你有另一个 /META-INF/resources/common/webappfooter.jsp 项目,那么以下包括应该做:

So, if you have a /META-INF/resources/common/webappfooter.jsp in the other project, then the following include should do:

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

如果您使用了一点自尊的IDE,您可以将其配置为自动捆绑其他作为webapp项目的 / WEB-INF / lib 的JAR项目。目前还不清楚你正在使用什么IDE,但在Eclipse中,将其他项目添加为主要webapp项目属性中的部署程序集

If you're using a bit self-respected IDE, you can configure it to automatically bundle the other project as JAR of webapp project's /WEB-INF/lib. It's unclear what IDE you're using, but in Eclipse it's a matter of adding the other project as Deployment Assembly in the main webapp project's properties.

在Eclipse中,要创建这样一个项目用正确的文件夹结构编写,选择Web Fragment Project向导。

In Eclipse, to create such a project with the right folder structure prepared, choose the "Web Fragment Project" wizard.

这篇关于如何将来自不同项目的JSP文件包含到我的项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆