using a variable within a JSP include directive

1 view
Skip to first unread message

Falk Köppe

unread,
May 17, 2009, 5:21:07 AM5/17/09
to Java Web Application
Hello,

is it possible to use variables within a JSP include directive? The
following code does not work for me:

<%
String page = "example.jsp";
%>

<@ include file="<%= page %>" %>
or
<@ include file="${page}" %>
or
<@ include file=page %>

I know that I could use the JSP include action (<jsp:include page="$
{page}" />), but I want to include the page at compile time, because
it almost never changes. Is there a way to use variables within a JSP
include directive?

Cheers
Falk Köppe
Reply all
Reply to author
Forward
0 new messages