• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getServletConfig() and getServletContext()

 
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ??
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you check the Javadocs for your answer?
 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please check Servlet, ServletConfig, ServletContext interface and GenericServlet class in JAVA API
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic