• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

.jsp mapping

 
Hugh O'Donnell
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :

<web-app>
<servlet servlet-name="jsppage"
servlet-class="hello">
</servlet>

<servlet-mapping url-pattern="/hello"
servlet-name="jsppage"/>
</web-app>

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 ]
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hugh,

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.



HTH

Sonny
[ October 11, 2004: Message edited by: Sonny Gill ]
 
Hugh O'Donnell
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this turned out not to be Resin-specific, I have modified the topic title accordingly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic