jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes Generic Sevlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Generic Sevlet" Watch "Generic Sevlet" New topic

Generic Sevlet

Gaurav Agarwal

Joined: Oct 13, 2004
Posts: 18
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

Joined: Apr 14, 2004
Posts: 10336

Init() is called when the servlet is initialised. See this servlet life cycle section of the J2EE tutorial.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Gaurav Agarwal

Joined: Oct 13, 2004
Posts: 18
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

Joined: Jul 17, 2006
Posts: 387

just read the javadoc of GenericServlet,

[ June 19, 2008: Message edited by: Herman Scheltinga ]
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Out of curiosity, why are you extending GenericServlet instead of HttpServlet?

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
shyam sham

Joined: Jun 16, 2008
Posts: 3
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

Joined: Jun 18, 2008
Posts: 14
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.
I agree. Here's the link: http://aspose.com/file-tools
subject: Generic Sevlet
It's not a secret anymore!