File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes context parameters from jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "context parameters from jsp" Watch "context parameters from jsp" New topic

context parameters from jsp

Dennis Cannell

Joined: Sep 04, 2001
Posts: 3

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

Joined: Sep 04, 2001
Posts: 3

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?
I agree. Here's the link:
subject: context parameters from jsp
It's not a secret anymore!