try{
var sync=true;
var req = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
req.open('POST','index.jsp',!sync);
req.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
req.send("aaa=马新良");
function stateChange(){
if(req.readyState==4){
alert(req.responseText);
}
}
if(!sync && req.onReadyStateChange)
stateChange();
else
stateChange();
}catch(e){
alert(e.description);
}
下面是取整个send字符串的代码:
BufferedInputStream isr =new BufferedInputStream(request.getInputStream());
byte[] bytes = new byte[(int)request.getContentLength()];
out.println(bytes.length);
while(isr.read(bytes)>0){
out.println(new String(bytes,"UTF-8"));
};
var sync=true;
var req = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
req.open('POST','index.jsp',!sync);
req.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
req.send("aaa=马新良");
function stateChange(){
if(req.readyState==4){
alert(req.responseText);
}
}
if(!sync && req.onReadyStateChange)
stateChange();
else
stateChange();
}catch(e){
alert(e.description);
}
下面是取整个send字符串的代码:
BufferedInputStream isr =new BufferedInputStream(request.getInputStream());
byte[] bytes = new byte[(int)request.getContentLength()];
out.println(bytes.length);
while(isr.read(bytes)>0){
out.println(new String(bytes,"UTF-8"));
};