当前位置: 代码迷 >> Java Web开发 >> 关于jsf中selectManyCheckbox的有关问题,多谢大家了
  详细解决方案

关于jsf中selectManyCheckbox的有关问题,多谢大家了

热度:243   发布时间:2016-04-17 12:29:24.0
关于jsf中selectManyCheckbox的问题,谢谢大家了。
在页面中有:
<h:selectManyCheckbox value="#{auser.quanx}" styleClass="bartext">
 <f:selectItems value="#{auser.qxItems}"/>
 </h:selectManyCheckbox>

在mybean中有:
private static String[] quanx=new String[3];
private static SelectItem[] qxItems = new SelectItem[]{

new SelectItem("用户设置"),

new SelectItem("栏目设置"),

new SelectItem("信息上传"),

};
问题是:怎样读取选择后的值? 我在代码中通过quanx[0],读取时总失败。

------解决方案--------------------
在线等待,谢谢大家了
------解决方案--------------------
改成這樣試一下
硬編碼的方式
Java code
  <h:selectManyCheckbox   value="#{auser.quanx}"   styleClass="bartext">    <f:selectItem itemLabel="用户设置" itemValue="1"/>    <f:selectItem itemLabel="栏目设置" itemValue="2"/>    <f:selectItem itemLabel="信息上传" itemValue="3"/>   </h:selectManyCheckbox>
------解决方案--------------------
好像还应该加一句private static String quanx="1"; 设个默认值
  相关解决方案