dcsimg
Virtual Directory Mappings within an Applications...
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Scott_Johnstone
Posted On:   Monday, April 1, 2002 07:07 AM

Hi, I am new to JSP/Servlets and I am trying to tackle an issue where I have a lot of content pages and servlets that I need to reuse for multiple sites. To replicate the site I am simply changing the presentation side Headers, Footers and Navigation. The Bulk of the pages will remain unchanged. So basically, for site "A" Page1.jsp includes Header.jsp and Footer.jsp. The Header and Footer files are in the "include" directory. For Site "B" I need Page1.jsp to include a different Header.jsp and Footer.jsp from an alternative "include" directory. In the IIS world, we created "virtual" directory mappings and just pointed the "include" virtual direc   More>>

Hi,


I am new to JSP/Servlets and I am trying to tackle an issue where I have a lot of content pages and servlets that I need to reuse for multiple sites. To replicate the site I am simply changing the presentation side Headers, Footers and Navigation. The Bulk of the pages will remain unchanged.


So basically, for site "A" Page1.jsp includes Header.jsp and Footer.jsp. The Header and Footer files are in the "include" directory. For Site "B" I need Page1.jsp to include a different Header.jsp and Footer.jsp from an alternative "include" directory.


In the IIS world, we created "virtual" directory mappings and just pointed the "include" virtual directory to actual directory "include-A" for site A and "include-B" for site B. The directives in Page1.jsp stayed the same for each site <%@ include file="/include/header.jsp" %>.


Is there a way to do this in JSP/Tomcat. I am using Tomcat 3.3a and can upgrade is needs be to 4.0.1.


Right now I can just copy the base code over and over but that causes a list of problems in and of itself, but it works.


Thank you.

   <<Less

Re: Virtual Directory Mappings within an Applications...

Posted By:   Dan_Waldner  
Posted On:   Monday, April 1, 2002 01:52 PM

Scott,


I don't have too much experience doing this, so if this seems a bit vague, you'll have to excuse me. In your server.xml there is a context tag. This explicitly specifies all of the apps you have in your webapps directory. Since you want a duplicate of your website, simply add as many context tags as you need to the server.xml file, specify distinct names for each, and point them all at the same file directory for path. This will create 3 seperate instances of the same app, with different app names. IE (this is just an example, not syntatically correct I'm sure):









I believe this will do what you wanted done.

Regards, Dan
About | Sitemap | Contact