• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

invalid servlet downloads

 
Greenhorn
Posts: 13
Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..

 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13
Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13
Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic