tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Navarro, Jose" <>
Subject Urgent (newbie) - Jsps located out of tomcat contexts
Date Tue, 02 Oct 2001 12:38:29 GMT

I have developed a servlet (a hit counter servlet, in fact) that I intend to
use in several pages in my  website.

Since it is a servlet, I think the best (perhaps the only?) way to invoke it
from an html web page is to embed some jsp code in them, in this way:

<jsp:include page="/hitscounter/servlet/hitscounter" flush="true">
  <jsp:param name="target" value="index" />

Here, the parameter "target" stands for the page being visited. Changing
this parameter I can perform the counting on different pages (I keep
different count files, the names of these are the value of the target
parameter). So the idea is to paste the previous snippet of jsp code in each
page I want to be tracked. Therefore, my html pages turn to jsp pages (with
a .jsp extension)

Well, obviously my web site has a hierarchical structure. So we have html
(some of them, now "would be" jsps) files spread across a tree that is not
located under the umbrella of tomcat contexts.

On the other side, the servlet is located under webapps/hitscounter. Well
this is as (I think) it should be.

Well, since TOMCAT does not process jsps when they are not located in a
registered context, my jsps are not found when I navigate through my
website. For instance, if I change my homepage from index.html to index.jsp,
I get a directory listing instead of the home page when I point my browser
to my home address. Or if I directly type the address, that is, I get a page not found error (HTTP 404).

If the set of pages I would keep track of (counting hits, I mean) would be
small, I would locate all these in a directory managed by tomcat. But this
is not the case! My website, in spite of its small size, is still big, so I
prefer to keep the actual directory hierarchy and leave tomcat in the place
it is.

Perhaps the solution is to define the root of my website as a tomcat context
(is it?). If so, tell me how, please! I have seen that a root context is
defined in the conf files but I suppose that this "root" (/) stands for the
root tomcat's directory (I'm a complete newbie, so I'm rather lost!)

Please, send your answer not only to the list but also to I have subscribed today to this list but received no
messages yet, so I'm not sure whether my subscription has been correctly

Thank you VERY MUCH for your time and interest.



P.S.: Perhaps I'm not cute enough, but I tried to solve the problem by
myself browsing the list archive without success.

View raw message