myfaces 使用动态的 t:radio
http://www.diybl.com/ 2008-3-8 网络 点击:
[ 评论 ]
文章搜索:
【点击打包该文章】
使用jsf 输出<input type="radio" /> 总有些麻烦,myfaces有一个 t:radio 实现感觉不错,但从一般用法上看太呆板了,如果事先不知道radio 个数有多少怎么办,这就需要使用动态的 t:radio 例如:
<h:form id="myForm">
<h:panelGrid columns="2">
<h:outputLabel for="buttons" value="List of Buttons"/>
<h:panelGroup>
<t:selectOneRadio id="buttons" layout="spread" forceId="true" forceIdIndex="false" value="${bean.button}">
<f:selectItems value="#{buttonList.selectList}" />
</t:selectOneRadio>
<t:dataList newspaperColumns="3" var="row" value="#{buttonList.dataModel}" rowIndexVar="index">
<h:column>
<t:radio for=":myform:buttons" index="#{index}" />
</h:column>
</t:dataList>
<h:panelGroup>
</h:panelGrid>
<h:form>
借助于t:dataList 或者t:dataTable 的rowIndexVar 给值 index就可以了,
注意:t:radio 的for :myform:buttons 必须这样写,有点怪的写法
如果图片或页面不能正常显示请点击这里 站内搜索:
推荐文章 |

