I just want to include an HTML file server-side into another HTML file, using JSP. PHP is not available. Is this what I want?
<jsp:include page="/include.html"></jsp:include>
I just want to include an HTML file server-side into another HTML file, using JSP. PHP is not available. Is this what I want?
<jsp:include page="/include.html"></jsp:include>
You have a couple of options. The first is <jsp:include>
. The second is <c:import>
. The c:
tags are JSTL, the JavaServer Pages Standard Tag Library.
What's the difference? Primarily <jsp:include>
inserts the contents of another JSP page within the same JAR relative to the current page whereas <c:import>
can read in an absolute or relative URL and display those contents on the page, retrieve a Reader
or store the contents in a variable.
The syntax for both is XML-like so:
<jsp:include page="header.jsp"/>
or
<jsp:include page="header.jsp"></jsp:include>
Note: both can take parameters.