Common jspaggingjsvarcurrentPage1; varmaxpagesize; varmessage; varurl & quot; varparam & quot; add a callback function -- modify and delete the functionsaveData (param, url, message, addDt
// Public js pagging. jsvar currentPage = 1; var maxpagesize; var message; var url = ""; var param = ""; // Add a callback function -- modify, delete the function saveData (param, url, message, addDtaFun, tb) {if (confirm (message) {$. ajax ({url: url, type: "post", data: param, // remember, data is the transmitted parameter dataType: "json", error: function (XMLHttpRequest, textStatus, errorThrown) {// alert ("========" + XMLHttpRequest. redayState + "|" + textStatus + "|" + e RrorThrown) ;}, success: function (data) {if (data = 1) {alert ("operation successful! "Commandid tb.html (" "); addDtaFun () ;}else {alert (" operation failed ") ;}}}// query data of all departments function addDept (deptId, url) {var param = ""; $. ajax ({url: url, type: "post", data: param, // remember, data is the transmitted parameter dataType: "json", beforeSend: function (){}, error: function (XMLHttpRequest, textStatus, errorThrown) {// alert ("======" + XMLHttpRequest. redayState + "|" + textStatus + "|" + errorThrown);}, success: function (data) {$. each (data, function (I, d) {// selectvar $ option = $ (""); $ Option. attr ("value", d. c_dep_name); $ option. text (d. c_dep_name); deptId. append ($ option) ;}})} // function addPerson (person, param) {var url = contextPath + "/emp/empList. action "; $. ajax ({url: url, type: "post", data: param, // remember, data is the transmitted parameter dataType: "json", beforeSend: function (){}, error: function (XMLHttpRequest, textStatus, errorThrown) {alert ("======" + XMLHttpRequest. redayState + "|" + textStatus + "|" + errorThrown);}, success: function (data) {$. each (data, function (I, d) {var $ option = $ (""); $ Option. text (d. c_emp_name); person. append ($ option) ;}})} // query all employees of the Ministry of Security and environment: function addcheckPersons (id) {var url = contextPath + "/emp/empCheckPerson. action "; $. ajax ({url: url, type: "post", // data: param, // remember, data is the transmitted parameter dataType: "json", beforeSend: function () {}, error: function (XMLHttpRequest, textStatus, errorThrown) {alert ("========" + XMLHttpRequest. redayState + "|" + textStatus + "|" + errorThrown);}, success: function (data) {// alert ("data =" + data); $. each (data, function (I, d) {var $ option = $ (""); $ Option. text (d. c_emp_name); id. append ($ option) ;}})} // pagingFunc (tb, addDtaFun) functions tb.html (""); // clear the content addDtaFun ();} // jump to function goPage () {var page = $ ("# page "). val (); // the page number is legal. if (valPagesize (page, maxpagesize) = true) {paging (page );}} // function valPagesize (size, maxpagesize) {if (size> = 1 & size <= maxpagesize) {return true;} else if (size <1) {alert ("page cannot be less than 1"); $ ("# page "). focus (); return false;} else if (size> maxpagesize) {alert ("the number of input pages cannot exceed the maximum"); $ ("# page "). focus (); return false;} else {alert ("the number of pages entered is invalid"); $ ("# page "). focus (); return false ;}}
Reference file include. inc <% @ page language = "java" import = "java. util. * "pageEncoding =" UTF-8 "%> <% @ taglib prefix =" c "uri =" http://java.sun.com/jsp/jstl/core "%> <% // context path String contextPath = request. getContextPath (); // topic path String themePath = "/template/themes/default"; pageContext. setAttribute ("themePath", themePath); pageContext. setAttribute ("contextPath", contextPath); %>