• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trying to test my first servlet.

 
Susan Smith
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm trying to test my first servlet. I use TOMCAT. I'm confused as how to call this servlet.
I put SampleServlet.java (below) under WEB-INF/classes
Then I compile the servlet. But then how do I call this servlet?

My servlet is like this:


Thanks in advance for all the help.
[ July 22, 2008: Message edited by: Susan Smith ]
 
Manuel Leiria
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must also configure your servlet in web.xml file.
 
Susan Smith
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please give me some pointers as what to change/ add in the web.xml file?
 
Manuel Leiria
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something like this:


So, you give the servlet a name (in this case sampleServlet) and tell the browser call the servlet when the url has /sampleservlet
 
Susan Smith
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works great!
Thanks Manuel.
 
Manuel Leiria
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Susan Smith:
It works great!
Thanks Manuel.


Glad to help!

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic