File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes .jsp mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark ".jsp mapping" Watch ".jsp mapping" New topic

.jsp mapping

Hugh O'Donnell

Joined: Jul 30, 2004
Posts: 13
Hi all,

I've just started using Resin and it's fantastic, but I'm having a bit of trouble with something that should be very simple. I have the following in a file in resin-3.0.9\webapps\jsptest\hello.jsp :

Hello World!

In resin-3.0.9\webapps\jsptest\WEB-INF\web.xml I have the following :

<servlet servlet-name="jsppage"

<servlet-mapping url-pattern="/hello"

However, the problem is, when I type the URL http://localhost:8080/jsptest/hello I get the following

error from Resin :

500 Servlet Exception
WEB-INF/web.xml:4: `hello' is not a known servlet. Servlets belong
in the classpath, often in WEB-INF/classes.

Resin-3.0.s041002 (built Sat, 02 Oct 2004 04:47:31 PDT)

I just don't get it. When I delete my web.xml file and try the URL http://localhost:8080/jsptest/hello.jsp it works fine. I have tried to manually compile the .jsp file but to no avail. I just want to be able to have a mapping between a URL and a .jsp file. Can anyone see what I'm doing wrong? When hello.jsp is compiled by Resin, I am assuming it is compiled to hello.class, as specified in my servlet-class="hello". I think this might be the problem.

Any help would be greatly appreciated.
[ October 11, 2004: Message edited by: Bear Bibeault ]

Hugh O'Donnell<br /> <br />SCJP 1.4, SCJD, SCBCD 1.3, SCWCD 1.4
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211


Try something along these lines. First you specify the servlet-name to JSP page mappping, in this case from 'test' to test.jsp.

Then you map the url pattern to the servlet defined in the first mapping, which effectively maps the url pattern to the JSP page.


[ October 11, 2004: Message edited by: Sonny Gill ]

The future is here. It's just not evenly distributed yet. - William Gibson
Sonny Gill LinkedIn
Hugh O'Donnell

Joined: Jul 30, 2004
Posts: 13
That did the trick exactly, thanks a million Sonny. I didn't realise I had to specify jsp-file instead of servlet-class.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63873

Since this turned out not to be Resin-specific, I have modified the topic title accordingly.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: .jsp mapping
It's not a secret anymore!