+1  A: 

Not sure if I get you right, but the simplest way would be something like:

<c:if test="${languageBean.locale == 'en'">
  <f:selectItems value="#{customerBean.selectableCommands_limited_en}" />
</c:if>

Just a quick copy and paste from an app of mine...

HTH

KB22
Hey,I think you're comparing a string to a 'constant' string here? languageBean.locale == 'en'? Whereas I'm comparing two variables, hence '==' won't work as that'll compare pointers.Thanks,CJ
CJ
you're right. was a bit of a snapshot, sry.
KB22
but actually, partially correct, as BalusC explains that the '==' is the correct operator after all and I can use that!
CJ
"Quick copy and paste" code snippets without actually **understanding** what they do is very harmful and doesn't put yourself in a big respect. I recommend not to do so. The same applies to mixing JSF with JSTL the way as you represented in the code snippet, but that's another story.
BalusC
@BalusC: is there a problem using JSF and JSTL together? Isn't JSF a higher-level framework than JSTL?
Mr. Shiny and New
+5  A: 

In Expression Language you can just use the == or eq operator to compare object values. Behind the scenes they will actually use the Object#equals(). This way is done so, because in EL you cannot invoke methods with other signatures than standard getter (and setter) methods.

So the particular line

<c:when test="${lang}.equals(${pageLang})">

should be written as (note that the whole expression is inside the { and })

<c:when test="${lang == pageLang}">

or

<c:when test="${lang eq pageLang}">

Both are behind the scenes roughly interpreted as

jspContext.findAttribute("lang").equals(jspContext.findAttribute("pageLang"))

If you want to compare constant String values, then you need to quote it

<c:when test="${lang == 'en'}">

which is behind the scenes roughly interpreted as

jspContext.findAttribute("lang").equals("en")
BalusC
Great stuff - thanks for such a clear explanation :o)
CJ
An my code is now working perfectly - thanks again!
CJ
You're welcome.
BalusC