日期:2014-05-16 浏览次数:20300 次
List<Access> lists=this.as.select(); ActionContext.getContext().put("lists",lists);
<tr><td><s:iterator value="#lists"> <tr><td><input type="checkbox" value="<s:property value='accessCode'/>" name="accessCodeId" id="accessCodeId"/>: <s:property value="name"/></td></tr> </s:iterator></td></tr>
CityUserAccess userAccesses=this.cuas.findUserAccess(userId); ActionContext.getContext().put("userAccesses",userAccesses);
public class Access { private String name; private String accessCode;
public class CityUserAccess { private String id;//无意义 private String userId; private String name; private List<String> accessCodeId;
<form name="form1"><input type="checkbox" name="accessCodeId" value="1" />1<br /> <input type="checkbox" name="accessCodeId" value="2" />2<br /> <input type="checkbox" name="accessCodeId" value="3" />3<br /> <input type="checkbox" name="accessCodeId" value="4" />4<br /> <input type="checkbox" name="accessCodeId" value="5" />5</form> <script type="text/javascript"> var asscessCodes = '1,2,5'; //将客户选择的值替换1,2,5,这里只是给个示例参考 var arr = asscessCodes.split(','); for (var i = 0; i < arr.length; i++) { for (var j = 0; j < document.form1.accessCodeId.length; j++) if (document.form1.accessCodeId[j].value == arr[i]) { document.form1.accessCodeId[j].checked = true; break; } } </script>