aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes My Browser Ask Me For A Program To Open A Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "My Browser Ask Me For A Program To Open A Servlet" Watch "My Browser Ask Me For A Program To Open A Servlet" New topic
Author

My Browser Ask Me For A Program To Open A Servlet

Eduardo Fierabras
Greenhorn

Joined: Sep 13, 2009
Posts: 8
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

Joined: Apr 21, 2008
Posts: 432
Hi Eduardo. Can you please post ListenerTester class?
Eduardo Fierabras
Greenhorn

Joined: Sep 13, 2009
Posts: 8
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi Eduardo. There is a typo. Use
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Eduardo Fierabras
Greenhorn

Joined: Sep 13, 2009
Posts: 8

Now all works fine!!!

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

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: My Browser Ask Me For A Program To Open A Servlet