如何从另一个文件夹中包含JSP文件 [英] How to include JSPs file from another folder
本文介绍了如何从另一个文件夹中包含JSP文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在另一个文件夹中包含JSP文件:
我的层次结构是WebContent / WEB-INF / JSPs /.../ p>
我要包含的JSP文件来自 /WebContent/WEB-INF/JSPs/body/content.jsp
,我将包含该文件的JSP文件是 / WebContent / WEB -INF / JSPs / header / navigation.jsp
到目前为止我尝试的是:
-
< jsp:include
page =../ JSPs / header / navigation.jsp>< / jsp: include> -
< jsp:include
page =/ WebContent / WEB-INF / JSPs / header / navigation .jsp>< / jsp:include>
解决方案
<你的相对路径是错误的。使用:
< jsp:include page =../ header / navigation.jsp>< / jsp:包括>
How can include JSPs file from another folder: My hierarchy is WebContent/WEB-INF/JSPs/..
My JSP file to be include is from /WebContent/WEB-INF/JSPs/body/content.jsp
and the JSP file where will i include the file is /WebContent/WEB-INF/JSPs/header/navigation.jsp
What i tried so far is:
<jsp:include page="../JSPs/header/navigation.jsp"></jsp:include>
<jsp:include page="/WebContent/WEB-INF/JSPs/header/navigation.jsp"></jsp:include>
解决方案
Your relative path is wrong. Use:
<jsp:include page="../header/navigation.jsp"></jsp:include>
这篇关于如何从另一个文件夹中包含JSP文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文