(jsp:Result页面)
在Result页面中增加按钮 ( DocspecialListParasForm.jsp )
{ text : '设置参数(修改按钮)', iconCls : 'icon-edit', handler : function() { var selectedArray = $(gridDocspeciallist).datagrid( 'getSelections'); if (selectedArray.length == 1) { var url = 'docspecial/specialParasform.do' + '?operateType=' + PAGETYPE.EDIT + '&ids=' + selectedArray[0].ID; $.farm.openWindow({ id : 'winFarmdocParas', width : 400, height : 230, modal : true, url : url, title : '知识设置参数' }); } else { $.messager.alert(MESSAGE_PLAT.PROMPT, MESSAGE_PLAT.CHOOSE_ONE_ONLY, 'info'); } } }
(jsp:创建FORM表单)
<%@ page language="java" pageEncoding="utf-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib uri="/view/conf/farmtag.tld" prefix="PF"%> <!--文档小组表单--> <div class="easyui-layout" data-options="fit:true"> <div class="TableTitle" data-options="region:'north',border:false"> <div class="tableTitle_msg">${MESSAGE}</div> <div class="tableTitle_tag"> <c:if test="${pageset.operateType==1}">新增${JSP_Messager_Title}记录</c:if> <c:if test="${pageset.operateType==2}">修改${JSP_Messager_Title}记录</c:if> <c:if test="${pageset.operateType==0}">浏览${JSP_Messager_Title}记录</c:if> </div> </div> <div data-options="region:'center'"> <form id="dom_formDocparas"> <input type="hidden" id="entity_id" name="id" value="${entity.id}"> <table class="editTable"> <tr> <td class="title">副标题:</td> <td colspan="3"><input type="text" style="width: 230px;" class="easyui-validatebox" data-options="required:true,validType:[,'maxLength[512]']" id="entity_name" name="name" value="${entity.name}"></td> </tr> <tr> <td class="title">排列顺序:</td> <td colspan="3"><input type="text" style="width: 230px;" class="easyui-validatebox" data-options="required:true,validType:['integer','maxLength[5]']" id="entity_sort" name="sort" value="${entity.sort}"></td> </tr> </table> </form> </div> <div data-options="region:'south',border:false"> <div class="div_button" style="text-align: center; padding: 4px;"> <c:if test="${pageset.operateType==2}"> <a id="dom_edit_entityDocparas" href="javascript:void(0)" iconCls="icon-save" class="easyui-linkbutton">修改</a> </c:if> <a id="dom_cancle_formDocparas" href="javascript:void(0)" iconCls="icon-cancel" class="easyui-linkbutton" style="color: #000000;">取消</a> </div> </div> </div> <script type="text/javascript"> var submitEditActionDocparas = 'docspecial/editParas.do'; var currentPageTypeDocparas = '${pageset.operateType}'; var submitFormDocparas; $(function() { //表单组件对象 submitFormDocparas = $('#dom_formDocparas').SubmitForm({ pageType : currentPageTypeDocparas, grid : gridDocspeciallist, currentWindowId : 'winFarmdocParas' }); //关闭窗口 $('#dom_cancle_formDocparas').bind('click', function() { $('#winFarmdocParas').window('close'); }); //提交修改数据 $('#dom_edit_entityDocparas').bind('click', function() { submitFormDocparas.postSubmit(submitEditActionDocparas); }); }); //--> </script>
在后台Controller类中
/** * 进入修改专题知识参数的表单页面 * * @return */ @RequestMapping('/specialParasform') public ModelAndView specialParasform(RequestMode pageset, String ids) { try { String imgurl = null; String iconurl = null; Docspecial entity = null; // 修改 return ViewMode.getInstance().putAttr('pageset', pageset).putAttr('imgurl', imgurl) .putAttr('iconurl', iconurl).putAttr('entity', entity) .returnModelAndView('doc/DocspecialListParasForm'); } catch (Exception e) { return ViewMode.getInstance().setError(e + e.getMessage()) .returnModelAndView('doc/DocspecialListParasForm'); } }
在后台Controller类中
/** * 提交修改知识参数表单 * * @return */ @RequestMapping('/editParas') @ResponseBody public Map editParas(Docspecial entity, HttpSession session) { try { return ViewMode.getInstance().setOperate(OperateType.UPDATE).putAttr('entity', entity).returnObjMode(); } catch (Exception e) { log.error(e.getMessage()); return ViewMode.getInstance().setOperate(OperateType.UPDATE).setError(e.getMessage()).returnObjMode(); } }