Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Setting the root application

Duncan Strang

2003-08-21

Replies:

Hi

I hope you don't consider this too trivial a question but I have tried
everything I can think of to get this working. I have read as much of
the docs as I can, looked at the faq's and searched the archives. I know
the information is there but I can't find it.

I want to make my application the root application.
That is, I don't want to have to type in the context path after the port
I just want to type http://localhost:8080

Actually I have this working.
The first resource accessed is a Servlet
here's my servlet mapping

 <servlet-mapping>
    <servlet-name>LocaleChecker</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>

When I access http://localhost:8080 <http://localhost:8080/> the
servlet executes and forwards the request to a jsp dependant on weather
a cookie is available
here is the server.xml that sets the root application

<Context path="" docBase="mydir" debug="0"/>

here is the jsp that is being executed

...

<%System.out.println("JSP resource paths = " +
application.getResourcePaths("")); %>

<br><br>
<table>
  <tr>
    <td><img src="/images/england.gif"></td>
  </tr>
</table>

...

The output from getResourcePaths is

JSP resource paths = [/header.jsp, /images/, /.nbattrs, /getCountry.jsp,
/WEB-INF/]
Yes, the images are available in the images directory.

However, no matter what I do I cannot get the images to display. I have
tried every conceivable path expression without luck.

Any halp much appreciated.

Cheers
Duncan L.Srang


©2008 junlu.com - Jax Systems, LLC, U.S.A.