Search notes function Key listener events
$("#search_note").keydown(function(event){ var code=event.keyCode; if(code==13){ 请求发送 } })
SELECT * from GBshare cnshare_title like '% '
Send an AJAX request
Event bindings: Keyboard Listener events (KeyDown)
Get parameters: keyword, as the basis for fuzzy queries
Send request:/share/find.do
Server processing
Sharecontroller.searchnote (String keyword)
Shareservice.searchnote (String keyword)
String title="%";if(keyword!=null){ title="%"+keyword+"%";}shareDao.findLikeTitle(title);
Do not enter keywords to achieve full table query ('% ')
Input keywords for fuzzy query ('%keyword% ')
Sharedao.findliketitle (String keyword)
Mapper:select *
from cn_share where cn_share_title like #{keyword}
Ajax callback Processing
Search for paging requirements
select * from cn_share where cn_share_title like #{title} limit #{begin},3 n:抓取记录的起点,从0开始(0表示第一条) m:抓取记录的最大数 1 - 0 2 - 3 3 - 6 n - (n-1)*3
Handling Insert Database garbled problem
"jdbc:mysql:///cloud_note? useUnicode=true&charaterEncoding=utf8"
Jobs: The paging feature for searching shared notes (focus)
02-unit08: Search Notes feature, search paging, handle inserting database garbled issues