Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GenericServlet's getInitParameter()

 
riohk kurn
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Refer to API, genericServlet has method called getInitParameter(), but what does it refer to? You know, there are two types of init parameter. One from <context-param> and one from <init-param> inside <servlet>.
 
k space
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you read the javadoc carefully (listed below), you should find that it refers to the servlet init parameter, i.e. ServletConfig.
public java.lang.String getInitParameter(java.lang.String name)
Returns a String containing the value of the named initialization parameter, or null if the parameter does not exist. See ServletConfig.getInitParameter(java.lang.String).
This method is supplied for convenience. It gets the value of the named parameter from the servlet's ServletConfig object.
 
Maha Annadurai
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, GenericServlet implements the interface 'ServletConfig'. One of this interface methods is getInitParameter(). So it's basically coming from ServletConfig implementation.
-Maha
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic