Reputation: 2896
is any way how to include JSP file from local stored folder, under the WEB-INF?
I have in my config.properties defined absolute path ${externalFolder} to folder which contains external jsp files, controller mapped to /page and jsp page page.jsp which is in WEB-INF/jsp/ directory.
In this file page.jsp I want to call:
WEB-INF/jsp/page.jsp
<%@page session="true" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
...
<body>
<jsp:include page="${externalFolder}/someJspFile.jsp" />
</body>
</html>
Thank you for help.
Upvotes: 3
Views: 4140
Reputation: 2896
I solved this problem, using this custom servlet: Content tag lib.
Custom JSP tag. Lets you include file content into current page. Tag is similar to the standard JSP include, but now you may include files that are located outside of your web application. For example:
<%@ taglib uri="taglib.tld" prefix="add" %> <add:content file="c:/mydata/myfile.jsp"/>
Includes content of the given file (.html or .jsp for example). Parameters are:
1.file
: Full path to file
2.flush
: Optional parameter. Possible values are true or false. If this value is true tag flushes buffers. Default value is false.
3.cond
: Optional parameter. Describes a boolean value tag's behavior depends on. Default value is true (include content).
Upvotes: 3