Concat Strings to create a Resource Bundle KEY

Hello, I`m having a little problem. I need, at the same point o a JSF page to show 2 different messages depending on a String variable value inside a Bean.

Then I was thinking if a could have the 2 different keys for the 2 different messages written in the bundle file, but the first part of the key would be the same, then the second would be equal to the String variable in the bean, so I would need to do a concatenation to get the correct KEY and then retrieve the correct message. Is that possible? If so, how could I do that?

So far, I have tried: But none worked

#{messages[''+'']}

#{messages[''] + messages['']}

[658 byte] By [wilsonetoa] at [2007-10-3 0:44:44]
# 1

The + is an arithmetic operator, not string-concatenation -- if you apply it to strings, the EL will attempt to coerce them to numeric values in order to apply the '+'.

There are some string manipulation functions in the JSTL standard function library. "str-concat" is not one of them, but there is a "replace" function.

Assuming your resource bundle is called 'messages' and the key suffix is in a bean called 'keysuffix', you could try something like this:

#{message[fn:replace('blah.blah.SUFFIX', 'SUFFIX', keysuffix)]}

tony_robertsona at 2007-7-14 17:39:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...