jsp:include/c:import acting like include directive?

Hola all, I've cross posted this issue at the sun developer forums but it's driving me nuts and I'm hoping that I might get some different/additional insight here.

Basically what I have is a page using either jsp:include or c:import (I say either as I've tried using both) to include a jspf fragment. The fragment imports several taglibs (displaytag, ajaxtags, etc.,) and renders a table. Instead of the page using the c:import/jsp:include getting the response/rendering of the imported/included page, it's getting the source code of the included page, taglib declarations and all!

here is the jspf file:

I'd paste the source code of the page using the import to import this fragment but it's on a separate network and I don't care to type that much in ;-)

The code using <c:import url="WEB-INF/jsp/pagefragement.jspf" /> or <jsp:include page="WEB-INF/jsp/pagefragment.jspf" /> (these tags actually have a body with some parameters being set for the fragment).

is just getting the above code, <%@page, <%@taglib and all injected into the source at the point of the <c:import or <jsp:include. I'm fairly new to jsps so I'm not really sure how to trouble shoot this issue...

I'm using jboss and looking in my working directory the pagefragment.jspf is not being translated (tried it as a .jspf and a .jsp not that that should make a difference to my knowledge...).

The JSP include action will run the included page as separate JSP and merge the results at run time. In order to use it, you have to insure that the page you are including is a full JSP with a .jsp extension. In other words, the included page would have to be able to run as a standalone JSP.

Ben thanks for the reply. I believe I've attempted this as a .jsp file as well. I am indeed attempting to use the include action - I don't want the content statically included. What I can't figure out is why the include action would include the content as if it were static?

The jspf (I'll change that to jsp) I included in my initial post ought to be able to exist as a standalone jsp were it to come down to it - based on my understanding at least.

c moses

Greenhorn

Posts: 16

posted 10 years ago

I should clarify that I'm also using Spring MVC as my j2ee framework. My knowledge of either of these topics is somewhat spotty. I can't really think of a reason why the use of Spring MVC would at all impact jsp:include but perhaps there is something that I'm missing??

c moses

Greenhorn

Posts: 16

posted 10 years ago

bugger - it'd be nice to be able to edit my last post rather then clutter things up with another one. I just looked at sun's syntax ref for jsp:include - I hadn't realized that jsp:include processes BOTH static and dynamic pages. As that is the case, why exactly would the partial file I listed in my post be identified as a static file as opposed to a dynamic file???

Is one unable to have a dynamic relatively referenced jsp using the include tag? I'm guessing I'm just missing something painfully obvious here...