我通过两个JSP页面发送信息,但无法在第二个页面中打印信息。
function sendSuccess (dir) {
console.log(jdata);
$.ajax({
url: dir,
type: "POST",
data: jdata,
contentType: "application/json"
})
.done(function( response ) {
$("#energyQuote").hide();
$("#success_msg").html(response).fadeIn('slow');
});
}在使用console.log语句的Google Chrome中,我得到了这样的结果:
Object {name_id: "tre", tlfono: "435", email_id: "dg@dfss.ghj", consumo_hm: "324", numFront_id0: "324"…}consumo_hm: "324"cotizac_id: "24"email_id: "dg@dfss.ghj"kva_id0: "324"name_id: "tre"numFront_id0: "324"tlfono: "435"__proto__: Object在我用来打印的第二个JSP中:
<%= request.getAttribute("name_id") %>
<%= request.getParameter("name_id") %>
<%= ics.GetVar("jdata.type_Identify") %>但我总是得到空值。
发布于 2014-09-12 23:50:08
在第二个JSP中,编写以下代码行
BufferedReader bf = request.getReader();
StringBuffer sbf = new StringBuffer();
String line = null;
while((line = bf.readLine())!=null){
sbf.append(line);
}现在,您可以根据需要使用sbf对象中的数据。
https://stackoverflow.com/questions/25812027
复制相似问题