Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My Browser Ask Me For A Program To Open A Servlet

 
Eduardo Fierabras
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm trying to run an example from the book "Head First Servlets & JSP" (O'Reilly 2nd Edition).

A simple ServletContextListener (Page 168).

At first, I got a common error: HTTP Status 404. The problem was in my deployment descriptor, web.xml --> <url-pattern>ListenTest.do</url-pattern> without the slash before ListenTest.do

I put the "/" and redeployed the application. When I type again the url "http://localhost:8080/listenerTest/ListenTest.do", my browser (Firefox) ask me for a program to open files with the extension .do

It seems that the browser doesn't recognize ListenTest.do like a servlet. The following is my web.xml:



This is the folders structure:

Tomcat 6.0\webapps\listenerTest\WEB-INF\classes\com\example

The ListenerTester.class file (the servlet) is inside example, and the deployment descriptor (web.xml) in WEB-INF.

Tomcat Manager tells me that the application is running.

Any help will be very appreciated.

Thanks a lot!!!

 
Chinmaya Chowdary
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eduardo. Can you please post ListenerTester class?
 
Eduardo Fierabras
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Chinmaya Chowdary
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eduardo. There is a typo. Use
 
Ankit Garg
Sheriff
Posts: 9528
32
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eduardo please Use Code Tags when you post a source code. You can edit your message using button and then add code tags to it...
 
Eduardo Fierabras
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Now all works fine!!!

Thank you very much Chinmaya, and thanks too for Ankit.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic