2

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).

Community
  • 1
  • 1
davidbuzatto
  • 9,207
  • 1
  • 43
  • 50

1 Answers1

5

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.

davidbuzatto
  • 9,207
  • 1
  • 43
  • 50
  • Don't you think it would be better to upvote the existing answer rather than creating a duplicate question/answer? – jahroy Jan 05 '13 at 03:24
  • I don't think that is the same question. They are similar, not equal. I just answered my own question because it is a good practice and if the question remains opened, maybe it help another person with the same doubt. I just upvoted the answer of the question that you send me. Thanks. – davidbuzatto Jan 05 '13 at 03:35
  • 2
    No, don't. The existing question concerns modern JSF/Facelets. The current question concerns legacy JSP/Servlet. Whilst they have smiliarities in EL, they are definitely not the same. – BalusC Jan 05 '13 at 12:02