Web tier: servlets, JSP, Web frameworks: <jsp:include> with pages outside a web application
- Posted by: Sergei Batiuk
- Posted on: November 13 2001 09:06 EST
I have some 15 web appications that have common images and parts of JSPs (header, footers, tables of contents, for example). I would like to make a 'common.war' application that would contain all these common files. But as I noticed, <jsp:include> can include only pages bound to a local web context. I. e., in my application 'employees.war' in the 'index.jsp' page I would like to include a 'header.jsp' from the 'common.war' application, that is on another host ('thunder') , by using the following directive:
But this doesn't work, because this is interpreted as "/employees/http://thunder/common/header.jsp". Obviously, this file is not found in 'employees.war'...
Does anyone knows how to solve this problem?
- <jsp:include> with pages outside a web application by Dmitry Namiot on November 14 2001 15:41 EST
- <jsp:include> with pages outside a web application by Sergei Batiuk on November 15 2001 06:13 EST
- <jsp:include> with pages outside a web application by Erick Jones on December 01 2001 19:28 EST
See Content tag from Coldtags suite:
It does this job.
Thank you very much for you reply! Well, I see this is beyond the spec...
I have tried http://www.servletsuite.com/jsp.htm but it doesn't really solves my problem. I needed to include a file from another server, not in the local filesystem.
Browsing internet, I found an excellent solution! Take a look at http://jakarta.apache.org/taglibs/doc/io-doc/intro.html.
A simple solution would be to use the RequestDispatcher, rather than the <jsp:include> tag. For example:
ServletContext thisContext = config.getServletContext();
ServletContext c = thisContext.getContext("/contextName");
Maybe not the prettiest, but it works!