• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getServletConfig() and getServletContext()

 
jose chiramal
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<init-param>
<param-name>adminEmail</param-name>
<param-value>abc@yz.com</param-value>
</init-param>

In the servlet code I have :

out.println(getServletConfig().getInitParameter("adminEmail"));


how can we invoke getServletConfig() just like that ?? Does every servlet inherit a getServletConfig() method ???

Also in case of <context-param> i have in servlet code :

out.println(getServletContext().getInitParameter("sthg"));


how can we invoke getServletContext() just like that ??
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check the Javadocs for your answer?
 
Brij Garg
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check Servlet, ServletConfig, ServletContext interface and GenericServlet class in JAVA API
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic