頁面上用jquery ajax
. 代碼如下:
function createQS(name){
var value = encodeURI(name);
var queryString = {key:value};
return queryString;
}
//檢索姓名方法
function jiansuoByName(k,name){
if (name == '') {
alert("請輸入檢索的內容");
return;
}
$.post(basePath+"/sysmgr/searchesAjax/searchesJsonPlugin!searchesNameByOMCByName.action", createQS(name),
function(data){
//alert(data.result+'\n'+k); // John
setLine_memoryFunction_A(data.result,k);
}, "json");
}
在後台action裡
. 代碼如下:
import java.net.URLDecoder;
String _name = request.getParameter("key");
String name = URLDecoder.decode(_name,"utf-8");