Search code examples
javajspservletsjava-ee-6el

How to retrieve context parameters through EL in Java EE 6?


Possible Duplicate:
JSF 2 - How can I get a context-param value from web.xml using JSF EL?

I was used to retrieve context parameters using EL in this manner

${applicationScope.configs.parameterName}

And it works perfectly.

Now, I'm working a new project that uses Tomcat 7 and Java EE 6 (servlet and jsp spec) and the example above does not work. I created the web.xml just to set some parameters. Inside a servlet, I just use

getServletContext().getInitParameter( "parameterName" );

And it works fine, but when I try to use the first example in my JSPs, it does not work, nothing happens, like the "configs" map does not exists. I already searched for some solution but I didn't find anything. I tried several things too like:

${applicationScope.initParameter.parameterName}
${applicationScope.initParameters.parameterName}

And it does not work too. I would like to know how to retrieve context parameters in my JSPs using Tomcat 7 (Java EE 6).


Solution

  • I swear that I tried to search for it, but I didn't find anything. With jahroy comment I found what I need. It was pretty easy indeed. I just need to use:

    ${initParam.parameterName}
    

    I really forgot about it.