Forums Register Login

Using variables in the include directive

+Pie Number of slices to send: Send
Hello,
I have quite a few jsp pages that I would like to imbed in a master jsp page. The jsp that is imbedded would be determined by an sql query. The problem is that I don't know how to use a variable in the include directive's page attribute.
I've been able to make this work using the include action but the problem is that the included page needs to be able to access a hashtable in the parent. This doesn't work in the action include.
Does anybody know how to do something like:
<%@ include file="<%= myFile %>"%> or another approach that I might be overlooking?
Thanks, Richard
+Pie Number of slices to send: Send
You have to use the JSP (XML-style) tags. THis is a quote from the JSP Syntax sheet

Note that this means you can do ...page="<%=pageName%>"... but may not be able to do ...page="/images/<%=pageName%>"... depending on the server you are using.
Dave.
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1212 times.
Similar Threads
Can I build in Java1.4 and run on Java1.6
JSP:Include question
Struts logic redirect
Using dynamic keys with bean:message tag
Using dynamic keys with bean:message tag
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 10:32:23.