Link to home
Start Free TrialLog in
Avatar of paries
paries

asked on

need to redirect from html to servlet or jsp

I am going to try to explain this problem.
I have this site that uses apache 2 and tomcat and uses a connector between the two. Apache serves up my static pages and my images.

my site has a bunch of users with their own sites and doc roots.
for example.
http://www.mydomain.com/kam
http://www.mydomain.com/sue
http://www.mydomain.com/fred

i have lots of users.
in order to distribute the directories alittle and not have 1000's of users all under one directory i do mod-rewrite with apache.
for example

http://www.mydomain.com/kam
the doc root is /home/docroot/k/kam
http://www.mydomain.com/fred
the doc root is /home/docroot/f/fred

So hopefully you see the pattern.

one more note, apache understands the mod-rewrite, but tomcat obviously does not.

so here is my problem

in the frames world i do the following (this would be the index.html in /home/docroot/k/kam/index.html
and they would get to it by http://www.mydomain.com/kam

<HTML>
<HEAD>
<META HTTP-EQUIV=Expires CONTENT="Tue, 04 Dec 1993 21:29:02 GMT">
<TITLE>kam 's Page</TITLE>
</HEAD>
<FRAMESET MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=NO BORDER=0  ROWS="100%,0">
<FRAME NORESIZE SCROLLING="auto" NAME="title" MARGINWIDTH=0 MARGINHEIGHT=0 NORESIZE SRC="/servlet/publicServlet?method=showMembersPage&id=965&lang=0" TARGET=_top>
</FRAMESET>
</HTML>

So i want to get rid of the frames.

so what i have working now is in my index.html
<html>
<head>
<META HTTP-EQUIV=Expires CONTENT="Tue, 04 Dec 1993 21:29:02 GMT">
<meta http-equiv="refresh" content="0;url=/servlet/publicServlet?method=showMembersPage&id=965&lang=0">
</head>
</html>

i was going to have an index.jsp but that would mess up everyones URLS because instead of
http://www.mydomain.com/kam(implied /index.jsp)
they would have to do because tomcat does not recognize the mod_rewrite.
http://www.mydomain.com/k/kam

So what i am asking is for a more elegant solution, if there is one.

I hope this makes sense







Avatar of girionis
girionis
Flag of Greece image

You can still use a JSP if you redirect from the original index.html to a index.jsp. In your /home/docroot/k/kam/index.html you could have something like

<meta http-equiv="REFRESH" content="0;url=http://www.mydomain.com/kam/index.jsp">

and the index.jsp should be the page without farmes.
Avatar of paries
paries

ASKER

thats,
actually the index.jsp would do a couple of env checks and call
/servlet/publicServlet?method=showMembersPage&id=965&lang=0, just like index.html

so i guess what you are saying is that the meta refresh is really the only option

ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial