• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getInitParameter()

 
Bob Moranski
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have a question about the method getInitParameter(String parameterName). When we invoke this method, do we call it as ServletConfig.getInitParameter() or just getInitParameter()?
I have seen some example use one and some the other.
Thanks.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method getInitParameter( String name ) is an instance method of ServletConfig. You can get the ServletConfig object for a servlet when it is passed to init or your can get it anywhere in the servlet class by:
getServletConfig()
Important: if getServletConfig() returns null, you probably forgot to have your init method call super.init
public void init(ServletConfig conf ){
super.init( conf );
.....
}
Bill

------------------
author of:
 
Bob Moranski
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic