读书人

整合排序的一种方法

发布时间: 2012-11-14 10:12:18 作者: rapoo

调整排序的一种方法

<%@ page contentType="text/html; charset=gb2312" %><%@ taglib uri="epmui.tld" prefix="epmui" %><%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %><%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %><%@ page import="com.infohold.base.bean.ListBEAN"%><html><%ListBEAN listBean = null;if(request.getAttribute("list") != null) {listBean = (ListBEAN)request.getAttribute("list");}int totalSize = 0;int pageNo = 0;int pageSize = 0;if(listBean != null) {totalSize = listBean.getTotalSize();pageNo = listBean.getPageNo();pageSize = listBean.getPageSize();}%><head>    <meta http-equiv="Content-Language" content="zh-cn">    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">    <jsp:include page="../../Share/head.jsp" flush="true"/>    <title>外部单位管理</title></head><script language="javascript"><!--function moveMenu(menuid,menuordernum,movetype,rowid){var num,prenum,premenuid,nextnum,nextmenuid,maxnum;document.getElementById("movetype").value = movetype;num = parseInt(rowid);if(movetype=="up"){if(num==1){alert("当前已经处于第一位!");}else{prenum = document.getElementById("menuorder_"+(num-1)).value;premenuid = document.getElementById("menuid_"+(num-1)).value;document.getElementById("premenuid").value = premenuid;document.getElementById("premenuordernum").value = prenum;document.getElementById("nowmenuid").value = menuid;document.getElementById("nowmenuordernum").value=menuordernum;$('mode').value="updateWbdwForOrder";document.getElementById("wbdwform").submit();}}else{maxnum = parseInt(document.getElementById("totalMenus").value);if(num>=maxnum){alert("已经处于最后了!");}else{nextnum = document.getElementById("menuorder_"+(num+1)).value;nextmenuid = document.getElementById("menuid_"+(num+1)).value;document.getElementById("nextmenuid").value = nextmenuid;document.getElementById("nextmenuordernum").value = nextnum;document.getElementById("nowmenuid").value = menuid;document.getElementById("nowmenuordernum").value = menuordernum;$('mode').value="updateWbdwForOrder";document.getElementById("wbdwform").submit();}}}// --></script><script type="text/javascript">    function gotoadd() {        location.href = '/comminfo/wbdw/wbdw_add.jsp';    }    function todel(thisform) {     selectcount = getNamedCheckBoxCheckedCount(wbdwform, wbdwform.id, "id");        if (selectcount == 0) {            alert("请先选择最少一条你要删除的信息。");        } else {            //window.location.href="gzjhzjdetailshow.do?info_type=1&jhzj_bh="+bh;            if (confirm('你确定要删除选定的记录?')) {                thisform.mode.value = "dealAction";                thisform.submit();            }            ;        }    }            function toedit(thisform) {                  selectcount = getNamedCheckBoxCheckedCount(wbdwform, wbdwform.id, "id");        if (selectcount == 0) {            alert("请先选择一条你要进行修改的条目。");        } else if (selectcount > 1) {            alert("一次只能选择一条信息进行修改。");        } else {            thisform.mode.value = "modifyPage";            thisform.submit();        }            }</script><body ><html:form action="/wbdwAction.do" method="post"><input type="hidden" name="mode" >    <table cellspacing="0" cellpadding="0" width="100%">        <tr>            <td valign="top"><table width="100%">                    <tr height="24">                        <td align="left" cellspacing="0" cellpadding="0" width="100%">                    <tr height=26>                        <td colspan="2">                                  <html:button property="button" stylevalue="新 增" onclick="gotoadd()"/>                            <html:button property="button" stylevalue="修 改"                                         onclick="toedit(this.form)"/>                            <html:button property="button" stylevalue="删 除"                                         onclick="todel(this.form)"/>                        </td>                    </tr>                </table>                <br>                <table border="1">                    <tr class='MToolBar'>                        <td width="4%" property="totalMenus"/>                        </td>                    </tr>                                         <logic:iterate id="row" name="list" property="list" indexId="rowid">                        <tr >                            <td align="center"><html:multibox name="wbdwform" property="id" styleproperty="id"/>                            </html:multibox></td>                                                        <td align="center"  >                                                 <input type="hidden" name="menuorder_<%=rowid+1%>" id="menuorder_<%=rowid+1%>" value="<bean:write name="row" property="xh" />">                            <input type="hidden" name="menuid_<%=rowid+1%>" id="menuid_<%=rowid+1%>"                             value="<bean:write name="row" property="id" />">                             <bean:write name="row" property="mc" />                            </td>                            <td align="center" >                            <input type="button"  value="上 移"                                         onClick="moveMenu('<bean:write name="row" property="id" />','<bean:write name="row" property="xh" />','up','<%=rowid+1%>');" />                             <input type="button" value="下 移"                                   onClick="moveMenu('<bean:write name="row" property="id" />','<bean:write name="row" property="xh" />','down','<%=rowid+1%>');" /> </td>                        </tr>                    </logic:iterate>               <epmui:epmNavigation form="wbdwform" totalSize="<%=totalSize%>" pageSize="<%=pageSize%>" pageNo="<%=pageNo%>" imagepath="<%=request.getContextPath()%>"></epmui:epmNavigation>                </table>              <iframe name="ChildFrame" width="0" height="0"></iframe>            </td>        </tr>    </table>    <input type="hidden" name="moveflag" id="moveflag" value="1"><input type="hidden" name="movetype" id="movetype"><input type="hidden" name="premenuid" id="premenuid"><input type="hidden" name="premenuordernum" id="premenuordernum"><input type="hidden" name="nowmenuid" id="nowmenuid"><input type="hidden" name="nowmenuordernum" id="nowmenuordernum"><input type="hidden" name="nextmenuid" id="nextmenuid"><input type="hidden" name="nextmenuordernum" id="nextmenuordernum"></html:form></body></html>

?

?

action:部分

?

public ActionForward updateWbdwForOrder(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception {WbdwForms wbdwform = (WbdwForms)form;String moveflag = wbdwform.getMoveflag();String movetype = wbdwform.getMovetype();String changeid ="";String changexh ="";String nowid ="";String nowxh="";if("1".equals(moveflag)){if("up".equals(movetype)){ nowid = wbdwform.getNowmenuid(); nowxh =wbdwform.getNowmenuordernum(); changeid= wbdwform.getPremenuid(); changexh = wbdwform.getPremenuordernum();}else{ nowid = wbdwform.getNowmenuid(); nowxh =wbdwform.getNowmenuordernum(); changeid= wbdwform.getNextmenuid(); changexh = wbdwform.getNextmenuordernum();}}service.updateWbdwForOrder(nowid, nowxh, changeid, changexh);return mapping.findForward("towbdw");// Constant.Error-出错页面,Constant.info-程序}

?

读书人网 >软件架构设计

热点推荐