【发布时间】:2010-05-17 20:59:43
【问题描述】:
我在使用h:selectOneRadio 时遇到了一些问题。我有一个需要显示的正在返回的对象列表。我正在尝试这样的事情:
<h:selectOneRadio id="selectPlan" layout="pageDirection">
<f:selectItems value="#{detailsHandler.planList}" />
</h:selectOneRadio>
planList 是一个计划列表。计划定义为:
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
}
每个单选按钮必须出现的文本实际上是在一个属性文件中,我需要在文本中插入参数来填充 bean 中的一些值。例如我的属性文件中的文本是:
plan_price=The price of this plan is {0}.
我希望做这样的事情:
<f:selectItems value="<h:outputFormat value="#{i18n.plan_price}">
<f:param value="#{planHandler.price}">
</h:outputFormat>" />
通常,如果它不是h:selectOneRadio 组件,如果它只是文本,我使用h:outputFormat 和f:param 标记在我的.property 文件中显示消息,上面称为i18n,并插入一个参数在支持 bean 中。在这里这不起作用。有谁知道我该如何处理这个问题?
我收到了一份计划列表,每个计划都有自己的价格,要显示的文本保存在属性文件中。非常感谢任何帮助。
谢谢!
我现在能够按照以下建议解决上述问题。但现在我有另一个问题。 每个单选按钮项必须显示如下:
Click **here** to see what is included. The cost is XX.
以上是每个单选按钮显示的内容。 “这里”需要是一个用户可以点击的超链接,并且应该弹出一个包含更多信息的对话框。我可以显示上面的句子但是如何使“这里”可以点击?
由于上面是显示的内容,因此返回的是 SelectItem(Object value, String label) 的标签。
非常感谢任何想法。
【问题讨论】:
标签: jsf formatting