Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Can we define constructor in Servlet class?

Answer Posted / srikanth b

Yes, we can define constructor in Servlet class.
Constructor may be a Default Constructor or Parameterised
Constructor.
If we didn't write any constructor then the default
constructor will be executed. Because, to read init
parameters of a servlet we need servlet config object in the
life cycle of the servlet. Servlet config object object is
created after the execution of the constructor.

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the differences between jsp and servlet.

936


Explain the difference between servlet and cgi?

1107


Whether thread can be used in servlets?

1159


What is meant by session? Tell me something about httpsession class?

959


What are the various ways of session supervision in servlets?

946


A client sends requests to two different web components. Both of the components access the session. Will they end up using the same session object or different session ?

1027


Can we fetch the attributes related to a servlet on a different servlet?

1083


How can we achieve transport layer security for our web application?

967


explain the advantages of servlet life cycle?

931


Why is a constructor needed in a servlet even if we use the init method?

1091


What is servlet configuration?

1001


Which protocol will be used by browser and servlet to communicate

990


What are the differences between servlet context vs servlet config?

1021


What is difference between jsp and servlet?

1120


Which httpsession object is used to view and manipulate information about a session?

1115