File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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
I agree. Here's the link:
subject: problems with include directive
It's not a secret anymore!