Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ServletConfig Object  RSS feed

 
chintan ramavat
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers !

I am not getting one bullet in HFSJ (KB) book. In ServletConfig object they have given that, ServletConfig Parameters are configured in the DD(deployment descriptor). Please any body could light on the point, I am confused about the which parameters of ServletConfig there are trying to explain. Is that the one for Database connection / Bean look parameters ?? or something else.


- Thank you
- CHI
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66187
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Configuration parameters can be used for anything you want. They are simply name/value pairs that make sense to your web app or to a particular servlet.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example, you could have a servlet looking like this :


You'll get the "defaultColor" parameter via your ServletConfig's getInitParameter.
 
Amit Kumargupta
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ServletConfig object is used by the Servlet Container to pass information to the Servlet during it's initialization. Servlet can obtain information regarding initialization parameters and their values using different methods of ServletConfig class.Initialization parameters are name/value pairs used to provide basic information to the Servlet during it's initialization like JDBC driver name, path to database, username, password etc.
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to configure the parameters and their values for a particular servlet, then you can go for ServletConfig. And you can retrieve them using the API with respect to the ServletConfig object inside that Servlet (for which you had configured in web.xml).


Hope this helps!
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you tell me what page this bullet is on, I will try to explain what they mean and how it relates to the exam :-)
 
chintan ramavat
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you everybody for quick replies. Thank you Amit, Raghavan, and C.Verre for making it all clear.

- CHI
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!