Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include JSPs file from another folder

Tags:

include

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:

  1. <jsp:include page="../JSPs/header/navigation.jsp"></jsp:include>
  2. <jsp:include page="/WebContent/WEB-INF/JSPs/header/navigation.jsp"></jsp:include>
like image 300
user2785929 Avatar asked Sep 17 '13 09:09

user2785929


2 Answers

You should use jsp include tag as shown below from any jsp file.

<jsp:include page="/WEB-INF/JSPs/header/navigation.jsp"></jsp:include>
<jsp:include page="/WEB-INF/JSPs/header/navigation.jsp"></jsp:include>
like image 193
Sudhakar Avatar answered Nov 15 '22 04:11

Sudhakar


Your relative path is wrong. Use:

<jsp:include page="../header/navigation.jsp"></jsp:include>
like image 32
Ankur Lathi Avatar answered Nov 15 '22 04:11

Ankur Lathi