• 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

How to call a servlet from the browser ?

 
Greenhorn
Posts: 25
MySQL Database PHP Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all

I am following a very simple tutorial on servlets, it goes:

1 - code a class and compile it, it inherits from HttpServlet
(no pain here !!)

2 - Move the compiled class to /WEB-INF/classes
(kids class ah!!)

3 - restart tomcat
(I even re-started my PC several times, it�s tomcat 5.5)

4 - call: http://localhost:8080/myapp/MyServlet

I never get anything... always an error (The requested resource is not available).

The tutorial doesn�t say anything about the web.xml file. the index.jsp (with java code) works fine.

Is this the way to do things ? I have some experience with java but for the first time I am doing servlets, I wonder how so much trouble ???

Any help ???

Jorge

[ July 05, 2005: Message edited by: Jorge Pinho ]
[ July 05, 2005: Message edited by: Jorge Pinho ]
 
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
Two things:

1) Make sure that your servlet is in a package other than the default.

2) You must add a servlet and a mapping declaration to your web.xml.
 
Jorge Pinho
Greenhorn
Posts: 25
MySQL Database PHP Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...and there was light, it worked nicely on first try.

Thankx Bear
 
They worship nothing. They say it's because nothing lasts forever. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic