• Post Reply Bookmark Topic Watch Topic
  • New Topic

context parameters from jsp  RSS feed

 
Dennis Cannell
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,
How does one retrieve context parameters from web.xml via jsp pages. There are many examples of retrieving init-parameters (i.e. via ServerConfig object) but none for context-parameters (i.e. via ServerContext object).
I've tried
parameter = getSerlvetContext.getInitParamters("whatever");
The init method of a jsp servlet is not allowed to be overridden so you can't recreate a servlet approach to the problem.
The JSP specs. mention an implicit object called "application" which is supposedly the ServletContext of a JSP page but when I try
String parameter = application.getInitParameter("whatever");
I get
"Undefined variable or class name: application"
perhaps I'm doing this wrong.
Does any one have any idea?
Thanks for any help
 
Dennis Cannell
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

BTW, I've also tried:
ServletContext context = config.getServletContext();
String value = (String)context.getInitParameter("whatever");
I get
"Undefined variable or class name: config"
According to the documentation these objects are supposed to exist already like "out" and "request" hence the name "implicit"?
Can anyone throw any light on what I'm missing here?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!