0

I found this in some JSF page.

<h:outputText styleClass="resultLetter" value="#{msgs['result'.concat(searchResults.paginator.pageItems.rowIndex+1)]}" />

I'm confused and when I googled I didn't really find anything about the syntax with having [] and then even the '' with concat() in a value expression.

Could anyone be so kind and explain to me what happens here?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Hannes
  • 442
  • 1
  • 6
  • 23

1 Answers1

2

The

[]

operator is a shortcut for

java.util.Map#get(Object key)

and, in your case, key is a String made up out of 'result' and searchResults.paginator.pageItems.rowIndex+1.

For internationalization (i18n) bundles, the [] operator is often used to get a translation for the given key as specified in the appropriate bundle files.

Smutje
  • 17,733
  • 4
  • 24
  • 41