public static String getEformHTML(Map<String, String> prefs, String key) { StringBuilder sb = new StringBuilder(); List<LabelValueBean> forms = constructEformList(); for (LabelValueBean lvb : forms) { String checked = new String(); if (prefs.get(key) != null) { String[] savedValues = prefs.get(key).split(","); for (int x = 0; x < savedValues.length; x++) { if (savedValues[x].equals(lvb.getValue())) { checked = "checked=\"checked\""; } } } sb.append( "<input name=\"pref." + UserProperty.EFORM_NAME + "\" value=\"" + lvb.getValue() + "\" type=\"checkbox\" " + checked + "/>" + lvb.getLabel() + "\n"); sb.append("<br/>\n"); } return sb.toString(); }
public static String getSelect(Map<String, String> prefs, String key) { StringBuilder sb = new StringBuilder(); List<LabelValueBean> options = getOptions(key); String selectedValue = prefs.get(key); if (selectedValue == null) { selectedValue = new String(); } sb.append("<select name=\"" + key + "\">"); for (LabelValueBean option : options) { String selected = (option.getValue().equals(selectedValue)) ? "selected=\"selected\"" : ""; sb.append( "<option value=\"" + option.getValue() + "\" " + selected + ">" + option.getLabel() + "</option>\n"); } sb.append("</select>"); return sb.toString(); }
/** * 设置查询默认值 * * @param actionForm ActionForm 表单From * @param request HttpServletRequest Web请求 * @param response HttpServletResponse Web结果 * @throws CDealException 处理异常 */ public static void setQueryDefault( QueryForm pQueryForm, HttpServletRequest request, HttpServletResponse response) throws CDealException { // 初始化页面,初始化重大事项综合查询下拉菜单 QueryForm aWebForm1 = (QueryForm) pQueryForm; Connection mConn = null; PreparedStatement pstmt = null; String str = ""; // 要返回的 string String sKey = ""; // 取出的TREEMAP的KEY String sValue = ""; // 取出的TREEMAP的value ArrayList itemtype; try { // 从CODEMAP表里取 来源分类 菜单 ArrayList comeList = CCodeMap.getSortedMap("重大事项登记来源分类"); // 从CODEMAP表里取 本级政府任务督办 菜单 ArrayList localList = CCodeMap.getSortedMap("本级政府任务督办督查科"); // 从CODEMAP表里取 上级任务督办 菜单 ArrayList upList = CCodeMap.getSortedMap("上级任务督办督查科"); // 添加 来源分类 到一个数组里面去.然后统一输出到页面 str = "var department=new Array('','全部'"; int k = 0; for (; k < comeList.size(); k++) { LabelValueBean aLabelValueBean = (LabelValueBean) comeList.get(k); sKey = aLabelValueBean.getValue(); // 名字 str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY sValue = aLabelValueBean.getLabel(); // 值 str += "'" + sValue + "'\n"; // 取出的TREEMAP的value } str += ");\n"; str += " var permissionitem = new Array (" + k + ");\n"; str += "permissionitem[0]=new Array('','全部');\n"; // 添加 上级 事项类别列表 int j = 1; str += "permissionitem[" + j + "]=new Array('','全部'"; for (int i = 0; i < upList.size(); i++) { LabelValueBean aLabelValueBean = (LabelValueBean) upList.get(i); sKey = aLabelValueBean.getValue(); // 名字 str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY sValue = aLabelValueBean.getLabel(); // 值 str += "'" + sValue + "'\n"; // 取出的TREEMAP的value } str += ");\n"; j = 2; str += "permissionitem[" + j + "]=new Array('','全部'"; for (int i = 0; i < localList.size(); i++) { LabelValueBean aLabelValueBean = (LabelValueBean) localList.get(i); sKey = aLabelValueBean.getValue(); // 名字 str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY sValue = aLabelValueBean.getLabel(); // 值 str += "'" + sValue + "'\n"; // 取出的TREEMAP的value } str += ");\n"; // 把部门数组和许可事项输出到页面上 aWebForm1.setPrintSql(str); // 初始化重大事项综合查询下拉菜单 TreeMap itemstatusList = new TreeMap(); itemstatusList = CCodeMap.getMapByType("重大事项流程"); aWebForm1.setItemstatusList(itemstatusList); } catch (Exception e) { throw new CDealException("设置查询默认值时失败。", e); } }
/** * ] * * @param aWebForm AddForm * @param request HttpServletRequest * @param response HttpServletResponse * @throws CDealException * @throws Exception */ public static void setEdit1( EditForm aWebForm, HttpServletRequest request, HttpServletResponse response) throws CDealException, Exception { EditForm aWebForm1 = (EditForm) aWebForm; Connection mConn = null; PreparedStatement pstmt = null; String str = ""; // 要返回的 string String sKey = ""; // 取出的TREEMAP的KEY String sValue = ""; // 取出的TREEMAP的value TreeMap itemtype; // 初始化页面,初始化事项类别下拉菜单 // 初始化页面,初始化投诉形式下拉菜单 TreeMap COMPLAINVERSIONListName2 = new TreeMap(); // 取出aWebForm COMPLAINVERSIONListName2 = CCodeMap.getMapByType("行政过错职级"); aWebForm.setCOMPLAINEDGRADELIST(COMPLAINVERSIONListName2); TreeMap COMPLAINVERSIONListName3 = new TreeMap(); // 取出aWebForm COMPLAINVERSIONListName3 = CCodeMap.getMapByType("行政管理分类"); aWebForm.setXZGLFLList(COMPLAINVERSIONListName3); TreeMap COMPLAINVERSIONListName4 = new TreeMap(); // 取出aWebForm COMPLAINVERSIONListName4 = CCodeMap.getMapByType("行政过错表现形式"); aWebForm.setXZGCBXXSList(COMPLAINVERSIONListName4); try { // 从CODEMAP表里取 来源分类 菜单 ArrayList comeList = CCodeMap.getSortedMap("行政过错行为分类"); // 从CODEMAP表里取 本级政府任务督办 菜单 ArrayList localList = CCodeMap.getSortedMap("违反规定履行社会管理职责"); // 从CODEMAP表里取 上级任务督办 菜单 ArrayList upList = CCodeMap.getSortedMap("违反内部管理制度"); // 从CODEMAP表里取 上级任务督办 菜单 ArrayList lbList = CCodeMap.getSortedMap("其他贻误行政管理工作"); // 添加 来源分类 到一个数组里面去.然后统一输出到页面 str = "var XZGCXYFL=new Array('','全部'"; int k = 0; for (; k < comeList.size(); k++) { LabelValueBean aLabelValueBean = (LabelValueBean) comeList.get(k); sKey = aLabelValueBean.getValue(); // 名字 str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY sValue = aLabelValueBean.getLabel(); // 值 str += "'" + sValue + "'\n"; // 取出的TREEMAP的value } // CLog.println(str); str += ");\n"; str += " var permissionitem = new Array (" + k + ");\n"; str += "permissionitem[0]=new Array('','全部');\n"; // 添加 违反规定履行社会管理职责 int j = 1; str += "permissionitem[" + j + "]=new Array('','全部'"; for (int i = 0; i < localList.size(); i++) { LabelValueBean aLabelValueBean = (LabelValueBean) localList.get(i); sKey = aLabelValueBean.getValue(); // 值 // 添加每个部门对应的事项类别列表 str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY sValue = aLabelValueBean.getLabel(); // 名字 str += "'" + sValue + "'\n"; // 取出的TREEMAP的value } str += ");\n"; // 添加 违反内部管理制度 j = 2; str += "permissionitem[" + j + "]=new Array('','全部'"; for (int i = 0; i < upList.size(); i++) { LabelValueBean aLabelValueBean = (LabelValueBean) upList.get(i); sKey = aLabelValueBean.getValue(); // 值 // 添加每个部门对应的事项类别列表 str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY sValue = aLabelValueBean.getLabel(); // 名字 str += "'" + sValue + "'\n"; // 取出的TREEMAP的value } str += ");\n"; // 添加 其他贻误行政管理工作 j = 3; str += "permissionitem[" + j + "]=new Array('','全部'"; for (int i = 0; i < lbList.size(); i++) { LabelValueBean aLabelValueBean = (LabelValueBean) lbList.get(i); sKey = aLabelValueBean.getValue(); // 值 // 添加每个部门对应的事项类别列表 str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY sValue = aLabelValueBean.getLabel(); // 名字 str += "'" + sValue + "'\n"; // 取出的TREEMAP的value } str += ");\n"; // 把部门数组和许可事项输出到页面上 aWebForm1.setPrintSql(str); } catch (Exception e) { throw new CDealException("设置进入时限监察查询处理的初始值时失败。", e); } finally { if (pstmt != null) { try { pstmt.close(); } catch (Exception e) { } ; } if (mConn != null) { try { mConn.close(); } catch (Exception e) { } ; } } }