javaweb中ajax请求后台servlet(实例)
废话不多说,直接上代码
publicclassDZFP_jdbcextendsHttpServlet{
privatestaticfinallongserialVersionUID=1L;
publicstaticConnectionconn;
publicstaticResultSetrs=null;
publicstaticPreparedStatementps=null;
privatestaticStringurl="jdbc:oracle:thin:@192.168.100.11:1111:CRM";
privatestaticStringname="name";
privatestaticStringpwd="pwd";
protectedvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{
/*PreparedStatementps;
ResultSetrs=null;*/
response.setCharacterEncoding("utf-8");
request.setCharacterEncoding("utf-8");
response.setHeader("content-type","text/html;charset=UTF-8");
PrintWriterout=response.getWriter();
***********
out.print("{\"errorno\":[{\"list\":error}]}");
}
}
$.ajax({
type:"post",
url:"DZFP_jdbc",
dataType:"text",
data:{
taxcode:taxcode,
mobilenum:mobilenum
},
timeout:50000,
success:function(data){
varjsonobjs=eval("("+data+")");
varlist=jsonobjs.errorno[0].list;
},
error:function(){
alert("网络异常,请稍后重试");
}
});
DZFP_jdbc
weishijiestudio.hangxinwx.servlet.DZFP_jdbc
DZFP_jdbc
/DZFP_jdbc
以上这篇javaweb中ajax请求后台servlet(实例)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持毛票票。
热门推荐
10 朋友新年祝福语大全 简短
11 新年祝福语简短大方兔年
12 搬新家礼物祝福语简短
13 同学见面花束祝福语简短
14 五一假期祝福语幽默简短
15 离职欢送敬酒祝福语简短
16 对学弟的祝福语简短
17 考老师辞职祝福语简短
18 祝福语驱散霉运的话简短