tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Burak YĆ½lmaz <netson...@yahoo.com>
Subject Re: How to change(override) application path
Date Mon, 30 Jul 2007 18:51:12 GMT
Its an amazing solution

----- Original Message ----
From: Lyallex <lyallex@gmail.com>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Monday, July 30, 2007 9:29:01 PM
Subject: Re: How to change(override) application path


Hi

I've had all sorts of problems understanding how relative links are
resolved so I found this solution somewhere and it works well for me

All my pages import a header file (header.jsp) in header.jsp I have this

<%
String basePath = request.getScheme()+"://"+request.getServerName()+"/";
%>

<html>
  <head>
    <base href="<%=basePath%>">
     ....

Now I no longer have any problems with links not working, ever.

I have my app installed as the default app. If you are using a non
ROOT context you can append request.getContextPath() like this


<%
String basePath =
request.getScheme()+"://"+request.getServerName()+"/"+request.getContextPath()+"/";
%>

It works for me

Rgds
Duncan


       
____________________________________________________________________________________
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/

---------------------------------------------------------------------
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