• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP referencing

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have a general question about the <jsp:include> tag.

Here's the situation -
I have 3 applications deployed on a server running under Tomcat 5.5.9.

The first one contains a set of simple JSPs / static content scattered
in various locations around inside its directory structure. (Tomcat is configured to default to point to its top-level welcome file in its server's config.xml.)


The file structure looks like this:

...{Tomcat Install}/webapps/Application_Alpha
...{Tomcat Install}/webapps/Application_Beta
...{Tomcat Install}/webapps/Application_Gamma

Here's what I'd like to do: Alpha contains all the common look/feel files that enforce a standard I'm trying to impose on all the pages for this server machine. (That is, common JSPs, Cascading Style Sheets, Images, etc. )

For applications Beta and Gamma, what I'd like to do in their JSP pages is
reference the JSPs located under Alpha like so,

index.jsp (under Application_Beta/Gamma) welcome page:

<!--
...(xhtml declarations)...
-->

<jsp:include page="http://this.example.server/Application_Alpha/resources/header.jsp">

<body>

... (whatever)

</body>
</html>


The question I have is - is this possible ? and if so, how would I go about doing this ?? I've had some success referencing locations such as .css files and .gifs, but so far, have yet to be successful getting .jsp files to work.

I appreciate your help.

Thank you,
Chad
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The jsp:include action does not work for pages outside of the current context.

This can be done with JSTL.
Read up on <c:import .../>

Unless you have a real good reason for breaking your app up into mutiple contexts, I would avoid doing so.
A lot of people run into problems when they do this.
 
Chad Foor
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you !

That worked quite well.

Chad
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic