Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getServletConfig() in pageContext() not working

 
sasikumar palakkizhi
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I was experimenting with the init-param of a jsp file. My web.xml is



and the jsp page "BasicCounter.jsp" is



I got a result


My email is null
email is null

client email is alima1965@yahoo.com


I expected that since pageContext object is available in the page I can access the init-param values using that object. The same is the case with application object too. What is the reason for this behaviour?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to add init-params to a JSP via web.xml, you need to create a servlet mapping for your JSP and use the url defined in that mapping when making the request.

Context init params, on the other hand are bound to the Context object (which is available to all components of the app) will be available, regardless of how your JSP was invoked.
 
sasikumar palakkizhi
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mr.Ben Souther,

It is working fine. Thanks for the reply.. When I mapped in web.xml, all the implicit objects are available in the page..

Thanks once again for the immediate answer

sasikumar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic