aspose file tools*
The moose likes JSF and the fly likes How to display a message resource value using an argument via <h:outputText> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to display a message resource value using an argument via <h:outputText>" Watch "How to display a message resource value using an argument via <h:outputText>" New topic
Author

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

Daniel Haupt
Greenhorn

Joined: May 22, 2006
Posts: 13
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
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
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

Joined: May 22, 2006
Posts: 13
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

Joined: Oct 08, 2006
Posts: 2458
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

Joined: May 22, 2006
Posts: 13
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

Joined: Oct 08, 2006
Posts: 2458
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

Joined: May 22, 2006
Posts: 13
Works. It was not supported by the trinidad tag. Standard jsf tag works fine.

Thanks

Daniel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to display a message resource value using an argument via <h:outputText>
 
Similar Threads
Reference outer dataTable var in inner dataTable
Question on how to sort tomahawk datatable
dataTable in JSF
selectBooleanCheckbox
How to use datatable with no records in a list