This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes problems with include directive Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "problems with include directive" Watch "problems with include directive" New topic

problems with include directive

mocca az
Ranch Hand

Joined: Mar 07, 2001
Posts: 93
I have the following question. I would like to know how to pass a varable to a include directive.
<%@ include file=<%= myfile %> %>
This won't work. Compiler is complaining about the missing quotes
<%@ include file="<%= myfile %>" %>
This won't work because Tomcat is looking for this file name <%= myfile %> which doesn't exist.
What i am trying to do is to load diferent files into a table cell without reloading the entire page.
Greatly appreciated
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

you need to use the XML style include:
<jsp:include page="<%=myFile%>" flush="true" />
I recommend you check out the JSP syntax sheet available from the Sun site.
Um... off the top of my head. Wouldn't trust it too much.
mocca az
Ranch Hand

Joined: Mar 07, 2001
Posts: 93
Thank you David, that was exactly what i was looking foor.
It works great.
M, phx
subject: problems with include directive
It's not a secret anymore!