How do I include a file in my JSP file where I don't know the filename to include until runtime?
John Zukowski This question describes the basic difference between the <%@include file="abc.jsp"%> directive and the <jsp:include page="abc.jsp"> tag. Basically, the first is done at compile time and the latter is done at runtime.
If the filename itself isn't known until runtime, you need to include another directive in the use of <jsp:include> like:
<% String filename = "foo.jsp"; %> <jsp:include page="<%= filename %>" flush="true"/>