"js/getparameter.js"
>
<
/script>
//根據傳遞過來的引數name獲取對應的值
function
getparameter
(name)$(
"#search-button").
click
(function()
);
route_list.html
"js/getparameter.js"
>
<
/script>
$(function()
// alert(cid);
// alert(rname);
load
(cid);}
);
public
class
routedaoimpl
implements
routedao
if(rname != null && rname.
length()
>0)
sql = sb.
tostring()
;return template.
queryforobject
(sql, integer.
class
, params.
toarray()
); 返回integer
}@override
public list
findbypage
(int cid,
int start,
int pagesize, string rname)
if(rname != null && rname.
length()
>0)
sb.(" limit ? , ? ");
sql = sb.
tostring()
; params.
add(start)
; params.
add(pagesize)
;return template.
query
(sql,
new(route.
class
), params.
toarray()
);}}
public
class
routeservlet
extends
baseservlet
int cid =0;
if(cidstr != null && cidstr.
length()
>0)
int currentpage =0;
if(currentpagestr != null && currentpagestr.
length()
>0)
else
int pagesize =0;
if(pagesizestr != null && pagesizestr.
length()
>0)
else
//呼叫service查詢routebean物件,將其序列化為json,傳到service中
pagebean
pb = routeservice.
pagequery
(cid, currentpage, pagesize, rname)
;writejsonback
(pb, response);}
}
ublic class
routeserviceimpl
implements
routeservice
}
拼接sql語句一定要注意帶空格,最好是每一句都戴帽子和穿鞋子,因為這裡使用string來拼接,很容易連到一起。string sql = "select count(*) from tab_route where 1=1 ";
if
(rname != null && rname.
length()
>0)
//模糊查詢,所以要用%%包裹
string rname = request.
getparameter
("rname");
if(rname != null && rname.
length()
>0)
tomcat8可以自動處理亂碼問題
function
load
(cid, currentpage, rname)
這裡cid=0,會直接排除 zTree模糊搜尋
根據搜尋的值重新顯示整個ztree 1 輸入框 2 js chatgroupserarchbtn click function function doqueryalg4name value treeobj.shownodes nodelist 指定被顯示的節點 json 資料集合 if value ...
ztree模糊搜尋
1 方法 function 載入樹方法和事件 function searchdepart newdepartcontroller.do?gettreedata datatype json data success function list var setting check view data c...
全文模糊搜尋
1.對原文進行分詞,再通過相應的搜尋演算法進行查詢 主要是中文分詞,這裡推薦 2.資料庫方式,通過全文索引進行搜尋 建立全文索引的表的儲存引擎型別必須為myisam 問題是match against對中文模糊搜尋支援不是太好 新建乙個utf8 myisam型別的表並建立乙個全文索引 create t...