aspose file tools*
The moose likes Servlets and the fly likes invalid servlet downloads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "invalid servlet downloads" Watch "invalid servlet downloads" New topic
Author

invalid servlet downloads

asit dhal
Greenhorn

Joined: May 05, 2009
Posts: 13

I have an HTML page , register.html. It calls a servelet 'Register.java'

The problem is that, the servlet displays a form window for user input. When user inputs data and submits, then a new window appears which asks us to download Register.class file.

Please suggest me how to fix this ??

Here is the code..



http://kodeyard.blogspot.com/
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12779
    
    5
Two questions:
1. Under what environment are you executing this servlet?
2. Why are you extending GenericServlet, given that you appear to be writing a HTTP application?
You should be extending HttpServlet so you can use doGet, doPost, etc instead of service.

Bill
asit dhal
Greenhorn

Joined: May 05, 2009
Posts: 13

Its Glass Fish Opensource server(embedded in Net Beans 7).

Actually I am using this for the first time. So, whatever in the book, I am just following.

Can you suggest me what is the reason of that download comes ??
asit dhal
Greenhorn

Joined: May 05, 2009
Posts: 13

finally a day long R & D in google and so many hit and trial found the actual error...a silly spelling mistake....


should be
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12779
    
    5
asit dhal wrote:Its Glass Fish Opensource server(embedded in Net Beans 7).

Actually I am using this for the first time. So, whatever in the book, I am just following.


If the book is advising you to extend GenericServlet and override service method you have gotten a bad book.

Bill
Daniel Doboseru
Ranch Hand

Joined: Sep 26, 2011
Posts: 57
To better understand what Bill told you, you should know that the service method which you overriden, is used to handle the requests done to the Servlets. For a Generic Servlet, is ok to override it, but better than that, you should use an HttpServlet, and instead of overriding the service method, you just simply need to override the doGet()/doPost() methods. Besides that, there are many advantages when using a HttpServlet instead of a GenericServlet in a web-environment, so you might re-analyze your problem. Good day!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: invalid servlet downloads