Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generic Sevlet

 
Gaurav Agarwal
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
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate 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.
 
Herman Schelti
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 ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Out of curiosity, why are you extending GenericServlet instead of HttpServlet?
 
shyam sham
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
 
V Sahdev
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic