h:包含图像的selectOneRadio [英] h:selectOneRadio containing images
问题描述
我有啊:selectOneRadio标签用于显示多个单选按钮:
I have a h:selectOneRadio tag for displaying a number of radiobuttons:
<h:selectOneRadio value="#{myBean.radioButtonSelection}">
<s:selectItems value="#{myBean.getPossibleRadioButtonSelections()}" var="rs" label="#{rs.toString}"/>
</h:selectOneRadio>
现在,我希望有单选按钮,而不是带有字符串值(标签)的单选按钮旁边的图像。这可能吗?如果是这样,怎么样?
Now, instead of radiobuttons with string values (labels), I would like to have radio buttons with (clickable) images next to it. Is this possible? If so, how?
更新:
实际上,应该有文字和带有问号的图像,当点击它时显示模态面板。
Update: Actually, there should be both text, and an image with a question mark which shows a modal panel when clicked on it.
推荐答案
您可以使用< h:outputLabel for =form:radioGroupId:X> ;
并在里面放置一个< h:graphicImage>
。 (X是选项的编号)
You can use <h:outputLabel for="form:radioGroupId:X">
and place a <h:graphicImage>
inside. (X is the number of the option)
当然,您必须有两个集合 - 一个包含项目,另一个包含图片,并分别迭代它们 - 一个带有< s:selectItems>
,另一个带有< ui:repeat>
。有点单调乏味。
Of course you would have to have two collections - one with the items, and one with the pictures, and iterate them separately - one with <s:selectItems>
and the other with <ui:repeat>
. A little tedious.
这篇关于h:包含图像的selectOneRadio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!