• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

.jsp mapping

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 1211
Mac IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since this turned out not to be Resin-specific, I have modified the topic title accordingly.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic