2

Currently I am successfully getting the labels from my resource bundle via

<h:outputFormat value="#{labels['key']}">
   <f:param value="my param1"/>
   <f:param value="my param2"/>
</h:outputFormat>

But how do I save it in a variable so that I can use it inline like

<i data-original-title="#{myLabel}"></i>

I am looking for something like

<h:outputFormat var="myLabel" value="#{labels['key']}">
   <f:param value="my param1"/>
   <f:param value="my param2"/>
</h:outputFormat>

But that doesn't seem to work

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Rey Libutan
  • 5,226
  • 9
  • 42
  • 73
  • What output your got? – Masudul Apr 11 '14 at 06:18
  • That last code block does not save anything to any var. – Rey Libutan Apr 11 '14 at 06:24
  • How should it save something? It’s an outputFormat and simply [renders parameterized text](http://docs.oracle.com/javaee/7/javaserverfaces/2.2/vdldocs/facelets). – lefloh Apr 11 '14 at 07:02
  • Yeah, thus the line "I am looking for something LIKE", because I know it doesn't work and I want to know something that works. Atleast that's what I tried so far :) – Rey Libutan Apr 11 '14 at 07:04
  • Why don’t you simple use MessageFormat and format it in your bean? – lefloh Apr 11 '14 at 07:16
  • We are not using managed beans as we are integrating JSF and Spring and we are only using JSF on the front-end. – Rey Libutan Apr 11 '14 at 07:18
  • But you are accessing SpringBeans in your Facelets? If not you could use MessageFormat, add the result to the request or session and access it via #{param} or #{session}. – lefloh Apr 11 '14 at 07:52

1 Answers1

0

You can use the Omnifaces extension of outputFormat: http://showcase.omnifaces.org/components/outputFormat

mmoossen
  • 1,237
  • 3
  • 21
  • 32