tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DIGLLOYD INC <digllo...@diglloyd.com>
Subject simple JSP redirect to another page -- how to deal with relative URLs
Date Fri, 25 Apr 2008 19:27:00 GMT
I previously asked about remapping URLs and got some helpful  
responses. In a nutshell, this was recommended:
http://tuckey.org/urlrewrite/

Looks very good for some purposes.

But I also want to solve a much simpler problem--

I have a very large amount of static content (articles), with each  
article in its own directory.  A main Table of Contents links to the  
start page in each directory, which is *not* index.html (eg some-main- 
page.html).  I don't want to rename or change those pages as they have  
world-wide direct links to them--they have to stay as-is.  But I do  
want to insert an index.jsp page without altering any content.

For many of these folders inserting a trival index.jsp solves the  
index-page problem:
<%@ include file="the-main-page.html" %>

(though I do wonder if google consider this unacceptable duplicate  
content)

My pages all use relative links eg "..", "./", etc.  So this works  
***when the page being included is in the same directory**.

But when the include page is in another directory, none of the  
relative links work.  None of these variants do the right thing; any  
referenced images cannot be found.

<%@ include  file="../ReviewInfo.html" %>
<jsp:include file="../ReviewInfo.html" %>
<jsp:forward page="../some-other-page.html" />

The jsp:forward directive seems perfect, but the flaw of not changing  
the current location (eg no "cd" is done first) makes it useless for  
this purpose.  Or does it?  Is there something I'm missing here?

Alternately, is there some other trivial solution?

URL-rewriting is not appropriate in this case; there is no particular  
pattern, just a fair number of specific cases.  I was hoping for a  
simple 1-line index.jsp in each directory.

Lloyd


Lloyd Chambers
http://diglloyd.com

[Mac OS X 10.5.2 Intel, Tomcat 6.0.16]





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message