Hai Maha,
Instead of hard coding URLs we did the following in our project. We were using Apache Jserv.
In the servlet zone configuration file , global init parameters can be given. These global init parameters are given to each of the servlets and are accessible in the servlet via the method getInitParameter() in ServletConfig.
In the configuration file, init parameter was specified as follows
servlets.default.initArgs=host=127.0.0.1,zone=/leave/servlets/
In servlet,
String host = getInitParameter("host");
String zone = getInitParameter("zone");
and servlets were invoked as follows:-
out.println( "<FRAME NAME=\"LogoFrame\" src=\"http://"+ host + zone + "main.LogoServlet\">");
So during run time the url was resolved as
http://127.0.0.1/leave/servlets/main.LogoServlet Similarly U may be able to configure Tomcat.
Regards,
Malu