javaweb中ajax请求后台servlet(实例)

网友投稿 253 2023-05-10


javaweb中ajax请求后台servlet(实例)

废话不多说,直接上代码

public class DZFP_jdbc extends HttpServlet{

private static final long serialVersionUID = 1L;

public static Connection conn;

public static ResultSet rs = null ;

public static PreparedStatement ps = null ;

private static String url = "jdbc:oracle:thin:@192.168.100.11:1111:CRM";

private static String name = "name";

private static String pwd = "pwd";

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

/*PreparedStatement ps;

ResultSet rs = null;*/

response.sekcIdHbbtCharacterEncoding("utf-8");

request.setCharacterEncoding("utf-8");

response.setHeader("content-type", "texkcIdHbbt/html;charset=UTF-8");

PrintWriter out = 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) {

var jsonobjs = eval("(" + data + ")");

var list = jsonobjs.errorno[0].list;

},

error: function() {

alert("网络异常,请稍后重试");

}

});

DZFP_jdbc

weishijiestudio.hangxinwx.servlet.DZFP_jdbc

&lthttp://;servlet-mapping>

DZFP_jdbc

/DZFP_jdbc


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:浅谈java7增强的try语句关闭资源
下一篇:用Eclipse 创建一个简单的web项目(图文教程)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~