• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Generic Sevlet

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generic servlet is a subclass of servlet interface. Generic servlet have one init() menthod. wht i m doing is extending the generic servelet and overwrite Init() method so my question is when that init() method will going to be call as web container will call the init(servlet config) method.

Anyone can put some light on it..


Thanks in advance.

Gaurav Agarwal
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Init() is called when the servlet is initialised. See this servlet life cycle section of the J2EE tutorial.
 
Gaurav Agarwal
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i know but web container can only call init with one argument(which is declare in servlet interface) but i m overwriting init() with no argument which is in generic servlet class method so in that case when that init() will call.
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

just read the javadoc of GenericServlet,
http://java.sun.com/j2ee/1.4/docs/api/index.html

Herman
[ June 19, 2008: Message edited by: Herman Scheltinga ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Out of curiosity, why are you extending GenericServlet instead of HttpServlet?
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for your reply guys.. i will try it

actually now me having problems with exporting the caption to excel.. everything is exporting but not caption.. i tried nested tables nested columns and all.. can you help me with POI export(i heard about it)
thank you
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you overwrite init() method at all , its for HttpServlet so that you can put some initialization parameters specific to that servlet instance and also provide the config object to the superclass using super.init(config), just in case you need to use that object later .
While extending GenericServlet you dont need to overwrite the init method , its already there.
 
You got style baby! More than this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic