• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to display a message resource value using an argument via <h:outputText>

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I'm using <h:outputText> to display messages from my resource bundles, e.g. in the following way:



My question now is: I have a message in my bundle using an argument, something like



How can I replace the {0}-Argument with a value using <h:outputText>?

Kind regards and thanks for your help

Daniel
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't. You should be using h:outputFormat instead. The parameters are to be added using f:param.

Consult the JSF TLD documentation for details.
 
Daniel Haupt
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. Can you give a short example of how to use or link the corresponding spot in the tld documentation??

f:param value will be the value I want to replace the {0} with. But how do I have to name the parameter?

Kind regards

Daniel
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don´t need to name it. Just place f:param tags consecutively in the same order as the placeholders of the message.
 
Daniel Haupt
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mmh... sorry. It doesn't works for me...

Here's my code snippet...



I only got "Attachments for milestone {0}" rendered in my browser.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That´s not a standard JSF tag. Read the TLDDOC which come along the taglib you seem to prefer over the standard taglib how to use it.
 
Daniel Haupt
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Works. It was not supported by the trinidad tag. Standard jsf tag works fine.

Thanks

Daniel
reply
    Bookmark Topic Watch Topic
  • New Topic