dev@jsftemplating.java.net

Placeholder substitution in resource bundle strings

From: Jennifer Chou <Jennifer.Chou_at_Sun.COM>
Date: Tue, 07 Nov 2006 16:19:04 -0500

Hi,

I just checked in some code that allow you to use placeholders in
resource bundle strings that get substituted dynamically on a jsf page.
See the following example for the syntax.

In .properties resource bundle specify the placeholders with {0} {1} etc:
catString=My cat {0} is {1}.

In .jsf page use commas to separate the arguments you want to pass in:
$resource{i18n.catString, Simba, fat}
You can use EL expressions for the arguments:
$resource{i18n.catString, #{name}, #{description}}

So the result will be:
My cat Simba is fat.

Jennifer