Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing h:outputFormat to message-format the f:selectItems of a h:selectOneRadio
    text
    copied!<p>I am having some trouble with using <code>h:selectOneRadio</code>. I have a list of objects which is being returned which needs to be displayed. I am trying something like this:</p> <pre><code>&lt;h:selectOneRadio id="selectPlan" layout="pageDirection"&gt; &lt;f:selectItems value="#{detailsHandler.planList}" /&gt; &lt;/h:selectOneRadio&gt; </code></pre> <p>and planList is a List of Plans. Plan is defined as:</p> <pre><code>public class Plan { protected String id; protected String partNumber; protected String shortName; protected String price; protected boolean isService; protected boolean isOption; //With all getters/setters } </code></pre> <p>The text that must appear for each radio button is actually in a properties file, and I need to insert params in the text to fill out some value in the bean. For example the text in my properties file is:</p> <pre><code>plan_price=The price of this plan is {0}. </code></pre> <p>I was hoping to do something like this:</p> <pre><code>&lt;f:selectItems value="&lt;h:outputFormat value="#{i18n.plan_price}"&gt; &lt;f:param value="#{planHandler.price}"&gt; &lt;/h:outputFormat&gt;" /&gt; </code></pre> <p>Usually if it's not a <code>h:selectOneRadio</code> component, if it's just text I use the <code>h:outputFormat</code> along with <code>f:param</code> tags to display the messages in my <code>.property</code> file called <code>i18n</code> above, and insert a param which is in the backing bean. here this does not work. Does anyone have any ideas how I can deal with this? </p> <p>I am being returned a list of Plans each with their own prices and the text to be displayed is held in property file. Any help much appreciated.</p> <p>Thanks!</p> <hr> <p>I am now able to resolve the above issue following the recommendation below. But now I have another question. Each radio button item must display like this:</p> <pre><code>Click **here** to see what is included. The cost is XX. </code></pre> <p>Now the above is what is displayed for each radio button. The "here" needs to be a hyperlink which the user can click and should bring up a dialog box with more info.I can display the sentence above but how do I make the "here" clickable?</p> <p>Since the above is what is displayed it is the label for SelectItem(Object value, String label) which is returned.</p> <p>Any ideas much appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload