Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP -> Servlet killing me

 
Anthony Lopez
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Using Tomcat 4.0.3, I am trying to "forward" the first hit that my site gets at www.mysite.com from a JSP to a servlet and then return the result in a way that you don't see anything resambling a static page, like, www.mysite.com/index.html (or www.mysite.com/index.jsp)
I can't get it right, and most of the examples I have found haven't helped me much.
How do you simply forward the very first hit to a servlet?
I don't know of any way to handle the first request with a servlet. why is that (apparently) not possible?
Thanks
Here is my line of thinking:
// fielder.jsp
<html>
<body>
<jsp:forward page="ROOT/servlet/BlackStage" />
</body>
</html>
// - - - - -
in <localhost_dir>/conf/web.xml commented the previous entries and substituted it with:
<welcome-file-list>
<welcome-file>fielder.jsp</welcome-file>
</welcome-file-list>
// - - - - -
For the BackStage servlet I am simply using the snoopservlet
// - - - - -
// this is how my webapp is set up
In case of the the entry point is webapp/BlackServlet:
<localhost_dir>/webapps/BackServlet/fielder.jsp
<localhost_dir>/webapps/BackServlet/WEB-INF/classes/BackStage
// - - - - - - - - - - - - - - - -
In case of the very first hit to the site (like via http://localhost):
<localhost_dir>/webapps/ROOT/fielder.jsp
<localhost_dir>/webapps/ROOT/WEB-INF/classes/BackStage
// - - - - - - - - - - - - - - - -
this is how I (presumably) made the servlet BackStage visible to the Webapp container:
In <localhost_dir>webapps/ROOT/WEB-INF/web.xml I inserted:
<servlet>
<servlet-name>BackStage</servlet-name>
<servlet-class>BackStage</servlet-class>
</servlet>
// - - - - - - - - - - - - - - - -
But this is the error I am getting:
HTTP Status 404 - /ROOT/servlet/BackStage
type Status report
message /ROOT/servlet/BackStage
description The requested resource (/ROOT/servlet/BackStage) is not available.
This is what was logged in the localhost_access_log:
127.0.0.1 - - [20/May/2002:21:42:23 -0500] "GET / HTTP/1.1" 302 654
127.0.0.1 - - [20/May/2002:21:42:23 -0500] "GET /fielder.jsp HTTP/1.1" 404 642
 
Bill Siggelkow
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks to me like you are trying to forward to a servlet that is identified by the URL as outside of the webapp context ... try forwarding to a relative URL for the servlet you want.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic