ฟังก์ชั่นการใช้งาน: ใช้การลากตาราง T และบันทึกระดับการเปลี่ยนแปลงเนื่องจากการลาก
รหัส JSP
<div id = "maincontainer"> <div> <div id = "b_center"> <div id = "การเปิดตัว-เด็นเทล"> <div> <h2 style = "margin-bottom: 0px; margin-top: 0px; ความสูง: 43px; line-height: 43px; id = "addlg" type = "ปุ่ม"> <img src = "/center/images/btn_add.png"> เพิ่มเมนู </button> </div> <br> <br> <br> <brol> <table cellpacing = "0" id = "showtable" style = "คำว่า style = "text-allign: center; width: 10%;"> number </th> <th align = "center" style = "text-allign: center; ความกว้าง: 17%"> ชื่อเมนู </th> <! style = "text-sallign: center"> เมนูระดับที่สอง </th>-> <th align = "center" style = "text-allign: center; ความกว้าง: 18%"> เมนูชื่อภาษาอังกฤษ </th> <th allign = "center" style = "text-align: center; center; <th align = "center" style = "text-allign: center; width: 20%"> การดำเนินการ </th> </tr> </thead> <tbody id = "data-list" style = "text-allign: center;"> <% ถ้า (menulist! = null && menulist.size () menulist.getJsonObject (i); เมนูเมนู = (เมนู) jsonobject.tobean (json.getjsonobject ("เมนู"), เมนู. class); %> <tr id = "<%= menu.getLevel ()%>"> <td id = "<%= menu.getMenuid ()%>"> <%= menu.getLevel ()%> </td> <td> <div> <%= menu.getMenUname ()%> <div> <%= menu.getenMenUname () == null? "": menu.getenMenUname ()%> </div> </td> <!-<td> <div> <%// ถ้า (เมนู menu.getHassecond () == 1) {%> เมนูระดับแรก <%// <div> <%// ถ้า (json.getString ("ischild"). เท่ากับ ("1")) {%> <a href = "JavaScript: void (0)" rel = "external nofollow" rel = "ภายนอก nofollow" rel = "nofollow ภายนอก" onclick = "getChildMenu ('<%// menu.getMenuid ()%>')"> ดู </a> <%//} else {%> ไม่มี <%//}%> </div> </td> -> <td> <div> 1) {%> ประเภทข้อความ <%} else {%> ประเภทลิงค์ <%}%> </div> </td> <td> <%ถ้า (menu.getState () == 0) {%> <button type = "ปุ่ม" onclick = "Changemenustate ('<%= menu.getmenuname () type = "button" style = "พื้นหลัง: #eaeaea; สี: #d0d0d0;"> ซ่อน </ปุ่ม> <%} else {%> <button type = "button" style = "พื้นหลัง: #eaeaea; color: #d0d0d0; %> ', <%= menu.getMenuid ()%>, 0) "> ซ่อน </ปุ่ม> <%}%> </td> <td> <%ถ้า (menu.getMenutype ()! = 0) {%> <div> rel = "ภายนอก nofollow" style = "สี: สีแดง; ความกว้าง: 30px; display: inline-block;" id = "<%= menu.getMenuid ()%>"> </a> </div> <%}%> <%ถ้า (menu.getMenutype ()! = 0) {%> <div style = "float: ขวา; nofollow "style =" สี: สีแดง; ความกว้าง: 30px; แสดง: inline-block; " id = "<%= menu.getMenuid ()%>"> </a> </div> <%}%> </td> </tr> <%}} else {%> <tr> <td colspan = "6" Align = "center" </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> <div style = "ความสูง: 50px; จุดสูง: 50px;"> <div style = "แสดง: ไม่มี;"> <a href = "#" rel = "ภายนอก nofollow" rel = "nofollow ภายนอก" rel = "nofollow ภายนอก" rel = "nofollow ภายนอก"> <a href = "#" rel = "ภายนอก nofollow" rel = "ภายนอก nofollow" rel = "nofollow ภายนอก" rel = "ภายนอก nofollow" rel = "nofollow ภายนอก"> weibo </a> | <a href = "#" rel = "nofollow ภายนอก" rel = "ภายนอก nofollow" rel = "nofollow ภายนอก" rel = "nofollow ภายนอก" rel = "nofollow ภายนอก" rel = "nofollow ภายนอก" rel = "external nofollow" ภายนอก " rel = "ภายนอก nofollow" rel = "nofollow ภายนอก" rel = "ภายนอก nofollow" rel = "nofollow ภายนอก" rel = "nofollow ภายนอก" rel = "nofollow ภายนอก" rel = "nofollow ภายนอก" rel = "external nofollow" ภายนอก " rel = "ภายนอก nofollow" rel = "nofollow ภายนอก" rel = "ภายนอก nofollow" rel = "nofollow ภายนอก" rel = "nofollow ภายนอก" rel = "ภายนอก nofollow" rel = "nofollow ภายนอก" rel = "external nofollow" external nofollow nofollow "rel =" ภายนอก nofollow "rel =" ภายนอก nofollow "rel =" ภายนอก nofollow "> ข้อกำหนดการให้บริการ </a> | <a href ="#"rel =" nofollow ภายนอก "rel =" nofollow ภายนอก "rel =" nofollow ภายนอก สงวนไว้ <span> </span> </p> </div> <script src = "/cvc/center/js/cached_lay_reports.js" type = "text/javascript"> </script> <script src = "/cvc/center/js/cached_lay_reports_cus.js id = "หน้ากาก"> </div> <div id = "addlogo" style = "จอแสดงผล: ไม่มี; z-index: 12; ความกว้าง: 800px; ความสูง: auto; margin-left: -50px;"> <div> <span style = "font-size: 16px; เมนู </span> <a id = "close_modal"> × </a> </div> <div id = "addz"> <div id = "registerdiv"> <form id = "menuform" method = "post" action = "< %= path %>/webCenter.do"> < value = "1"> <อินพุต type = "hidden" name = "conid" value = "< %= conid %>"> <อินพุตประเภท = "ซ่อน" name = "numb1" value = "< %= numb1 %>"> <อินพุตประเภท = "hidden" name = "numb2" value = "< %= numb2 %> <tr> <td> <pan> ชื่อเมนู </span> </td> <td> <อินพุตประเภท = "ข้อความ" id = "menu_name" name = "menuname" style = "margin: 10px 0px; display: inline-block; ความสูง: 34px; id = "menu_level" name = "menu_level" style = "มาร์จิ้น: 10px 0px"> <ค่าตัวเลือก = "-1"> โปรดเลือก ... </ตัวเลือก> <ตัวเลือกค่า = "1"> เมนูระดับแรก </ตัวเลือก> <td> เมนูหลัก: </td> <td> <เลือก id = "menu_parent" name = "menu_parent" style = "มาร์จิ้น: 10px 0px"> <ตัวเลือกค่า = "-1"> โปรดเลือก ... id = "menutype" name = "menutype" style = "margin: 10px 0px; display: inline-block; width: 350px;"> <ตัวเลือกค่า = "-1"> โปรดเลือก ... Style = "Display: None"> <td> เนื้อหาข้อความ </td> <td> <textarea rows = "45" cols = "70" name = "menucontent" id = "menucontent" style = "แสดง: inline-block;"> </textarea> </td> </td> ในที่อยู่ลิงก์ภายนอกที่สมบูรณ์ซึ่งจะต้องรวม <span style = "สี: สีแดง"> http: // </span> ตัวอย่างเช่น: http: //www.baidu.com </br> <อินพุต type = "text" id = "menul" name = "menull" style = "margin: 10px 0px"/> </tr> <tr> <td align = "center" colspan = "2"> <hr style = "margin-bottom: 10px;"> <อินพุต id = "menu_add" type = "ปุ่ม" value = "เพิ่ม" style = "border-radius: 0; </form> </div> </div> </div> </div> <div id = "childmenu" style = "แสดง: ไม่มี; z-index: 12; width: 650px; ความสูง: อัตโนมัติ; 16px; ขอบซ้าย: 20px; สี: #FFF "id =" gn_title "> เมนูระดับที่สอง </span> <a id =" close_modal "> </a> </div> <div id =" registerdiv "> <table cellpacing =" 0 "style =" word-wrap: break-word; Word-break: break-all; table-layout: สืบทอด; "> <thead> <tr> <th style =" text-allign: center "> number </th> <th align =" center "style =" Text-Align: Center "> ชื่อเมนู </th> <th allign =" center "center = เมนู </th> <th align = "center" style = "text-allign: center"> ประเภทเมนู </th> <th align = "center" style = "text-allign: center"> แก้ไข </th> <th align = "center" style = "text-align: center" src = "<%= path%>/cvc/center/js/my97datepicker/wdatepicker.js"> </script> <script src = "<%= path%>/cvc/center/js/sett.js" type = "text/javascript" src = "<%= path%>/cvc/center/js/validform_v5.3.2.js" type = "text/javascript"> </script> <script charset = "utf-8" src = "<%= path%>/train/js/prettify/kindeditor.js" src = "<%= path%>/train/js/prettify/lang/zh_cn.js"> </script> <script charset = "utf-8" src = "<%= path%>/train/js/prettify/plugins/code/prettify.js" %>/cvc/center/js/jQuery-1.10.2.min.js "> </script> <script charset =" utf-8 "type =" text/javascript "src =" < %= path %>/cvc/center/js/js/jquery src = "< %= path %>/center/js/jQuery-ui.min.js"> </script> <script> var editor1; */ถ้า (Menuname == "English") {Alert ("โปรดไปที่โมดูลข้อมูลพื้นฐานเพื่อตั้งค่าการประชุมประเภทจีนและภาษาอังกฤษในปัจจุบัน"); if (json.state == 1) {window.location.reload (); แอนิเมชันหยุด: Events, UI) {// หลังจากอัปเดต var categoryids = $ ("#showtable"). sortable ("toarray"); 1;}) ระดับ = 0; 1) {เนื้อหา += "ระดับ: +ระดับ; URL: "<%= path%>/webCenter.do?updateMenulevel", type: "post", ประเภท: "json", ข้อมูล: "menulist ="+เนื้อหา, ความสำเร็จ: ฟังก์ชั่น (json) {}})}}); $ ("#menu_level"). เปลี่ยน (function () {$ ("#menu_parent"). ว่าง (); $ ("#menu_parent"). ผนวก ("<ตัวเลือกค่า = '-1'> โปรดเลือก ... 2) {$ .ajax ({url: "<%= path%>/webCenter.do?getfirstmenu", พิมพ์: "รับ", ข้อมูล: "json", ความสำเร็จ: ฟังก์ชั่น (ผลลัพธ์) {ถ้า (ผลลัพธ์! = null && result! value = '"+ผลลัพธ์ [i] .menuid+"'> "+ผลลัพธ์ [i] .menuname+" </optup> "console.log (ตัวเลือก) $ ("#menual_parent ") ภาคผนวก (ตัวเลือก);}}} {แจ้งเตือน (" }}) // เลือกประเภทกราฟิก $ ("#menutype"). เปลี่ยน (ฟังก์ชั่น () {ถ้า ($ ("#menutype") val () == 1) {$ ("#imgtexttr") แสดง (); $ ("#linktr") if ($ ("#menutype"). val () == 2) {$ ("#imgtexttr"). ซ่อน (); $ ("menual_name"). val (); ชื่อ "); return false;} ถ้า (menutype ==" -1 ") {แจ้งเตือน (" โปรดเลือกประเภทเมนู "); return false;} ถ้า ($ ("#menutype "). val () == 1) {ถ้า ("#("#menucontent") การแจ้งเตือน ("กรุณากรอกข้อมูลในข้อความและข้อความ"); && $ ("menuid"). val () == -1) {Alert ("เมนูสามารถเพิ่มได้ถึงเก้า" $ ("#addlg"). คลิก (ฟังก์ชั่น () {$ ("#mask"). show (); $ ("#addlogo"). show ();}) // ยกเลิก $ (". tk1_header") คลิก (ฟังก์ชัน () {location.reload (); $ ("#zshref"). Val (""); $ ("addlogo"). show (); ความสำเร็จ: ฟังก์ชั่น (ข้อมูล) {$ ("menual_name"). val (data.menuname); editor1.html (data.content); -รหัสการดำเนินการ
@RequestMapping (params = "updateMenulevel", method = requestMethod.post) โมฆะสาธารณะ updateMenulevel (สตริง menulist, httpservletrequest คำขอ, httpservletResponse การตอบสนอง) {ลอง {httpsession session.getSession ผู้ดูแลระบบผู้ดูแลระบบ = session.getAttribute ("centeradminuser") == null? null: (adminuser) session.getAttribute ("centeradminuser"); if (adminUser == null) {ลอง {response.sendredirect (request.getContextPath ()+"/center/index.jsp"); } catch (exception e) {e.printstacktrace (); }} else {string conid = request.getSession (). getAttribute ("conid") == null? null: request.getSession (). getAttribute ("conid"). toString (); if (conid == null) {response.sendredirect (request.getContextPath ()+"/center/index.jsp"); } jsonArray array = jsonArray.FromObject (menulist); สำหรับ (int i = 0; i <array.size (); i ++) {jsonObject json = array.getJsonObject (i); เมนูเมนู = webservice.getMenubyId (json.getInt ("เมนู")); menu.setlevel (json.getint ("ระดับ")); WebService.SaveObject (เมนู); }}} catch (exception e) {e.printstacktrace (); -ตัวอย่างข้างต้นของการใช้งาน Java Table T การลากเป็นเนื้อหาทั้งหมดที่ฉันแบ่งปันกับคุณ ฉันหวังว่าคุณจะให้ข้อมูลอ้างอิงและฉันหวังว่าคุณจะสนับสนุน wulin.com มากขึ้น