1. 程式人生 > >s:checkboxlist 設定回顯選中

s:checkboxlist 設定回顯選中

<s:checkboxlist list="#request.docTypeCodeMap" name="bean.projectPlanTask.docTypeCode" listKey="key" listValue="value" value="%{#request.docTypeCodeList}"></s:checkboxlist>
String[] docTypeCodes = bean.getProjectPlanTask().getDocTypeCode().split(",");
List<String> docTypeCodeList = new ArrayList<>();
for (String string : docTypeCodes) {
    docTypeCodeList.add(string.trim());
}
request.setAttribute("docTypeCodeList", docTypeCodeList);

將儲存後的值,拆分存入list,傳到前臺。