Constructor in the Servlet

Constructor in the Servlet

Postby SHilpy » Wed Feb 06, 2013 3:57 pm

Can we write a constructor in the Servlet?
Posts: 6
Joined: Thu Jan 31, 2013 2:34 am

Re: Constructor in the Servlet

Postby Kishan » Thu Feb 07, 2013 2:27 am

Yes, you can write constructor but it must be zero argument constructor.

Reason, servlet object created by container so if constructor takes parameter then container doesn't know what to pass then it fails in the runtime.
Posts: 191
Joined: Tue Jan 29, 2013 4:21 am

Return to Servlets

Who is online

Users browsing this forum: No registered users and 2 guests