File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure 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
  • 0
  • 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: 432
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eduardo. Can you please post ListenerTester class?
 
Eduardo Fierabras
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Chinmaya Chowdary
Ranch Hand
Posts: 432
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eduardo. There is a typo. Use
 
Ankit Garg
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • 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
  • 0
  • 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.

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic