开发者

How to insert an image before each radio button using f:selectItems

I constructed the radio butto开发者_JAVA百科n group using f:selectItems. I constructed the radio button as follows

<h:selectOneRadio>
   <f:selectItems value="#{options}"/>
</h:selectOneRadio> 

How to insert an image before every individual radio button in the above code?


I don't think this is possible with standard JSF components. But you could use MyFaces Tomahawk to achieve this. The <t:selectOneRadio> component offers spread layout. This way you can place each radio button wherever you want. Something like this:

<t:selectOneRadio id="mySelectOneRadio" layout="spread">
   <f:selectItems value="#{options}"/>
</t:selectOneRadio>

<h:graphicImage value="/some/image1.png"/>
<t:radio for="mySelectOneRadio" index="0"/>

<h:graphicImage value="/some/image2.png"/>
<t:radio for="mySelectOneRadio" index="1"/>

..
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜