Context « Variable « JSP-Servlet Q&A

1. Problem accessing Context Variable

Hi, I have the following code in web.xml for initialising context parameter. myContextParamName myContextParamValue I am trying to access it in JSTL using ${initParam["myContextParamName"]} and it does not work. I am not sure if the changes to web.xml are being recognized. I tried to use a JNDI name that was set up on the server as a resource in ...

2. How to acess servlet context variables from java class

I prefer that my beans are container unaware. If I needed to do something like this, I would put all the variables that need to be shared into one object and bind that to context scope. then I would pass a reference to that object to any beans that need it's properties.