jsp接收servlet传值

ajax请求

$.ajax({    url: "<%=path%>/sso/servlet/IntegralEfficiencyServlet",    type: "post",    contentType: "application/x-www-form-urlencoded",    data: {"TOKEN": "<%=request.getParameter("token")%>"},    dataType: "text",success:     function(url){        console.log(url);        window.open("http://www.baidu.com");        return;    },    error:function(response){        console.log("error");    }});

$.post方式

$.post("<%=path%>/sso/servlet/IntegralEfficiencyServlet", {
    Action: "post",
    TOKEN: "<%=request.getParameter("token")%>",
    contentType: "application/x-www-form-urlencoded"
},
function(data, textStatus){
    alert(data + "," + textStatus);
});

servlet传值

response.setContentType("application/x-www-form-urlencoded");
response.getWriter().print(url);

你可能感兴趣的:(jquery)