日期:2014-05-18  浏览次数:20886 次

关于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"; 设个默认值