Rick Reumann wrote:
>
> This is a simple question I'm sure and I've checked the archives
> and it seems like the statement below should work:
>
> <jsp:include page="menu<%= btSession.getAccessLevel() %>.jsp" flush="true" />
>
> However the above isn't working. Can you not use scriplets like that
> inside of includes?
You can not combine static text and expressions like this in an attribute
value. You need to do something like this instead:
<%
String myPage = "menu" + btSession.getAccessLevel() + ".jsp";
%>
<jsp:include page="<%= myPage %>" flush="true" />
or
<jsp:include page='<%= "menu" + btSession.getAccessLevel() + ".jsp" %>'
flush="true" />
Note that I use single quotes to enclose the page attribute value in
the second example, since the attribute value includes double quotes.
Alternatively, you can use double quotes to embed the attribute value
and escape all double quotes in the value with a backslash.
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets