You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Navarro, Jose" <Jo...@ideg.es> on 2001/10/02 14:38:29 UTC

Urgent (newbie) - Jsps located out of tomcat contexts

Hi,

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" />
</jsp:include>

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,
http://www.ideg.es/index.jsp 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
jose.navarro@ideg.es. I have subscribed today to this list but received no
messages yet, so I'm not sure whether my subscription has been correctly
processed.

Thank you VERY MUCH for your time and interest.

Regards,

Jose.

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