有get,post,delete,put.
其中delete,put在tomcat 里模式不支持,需要在web.xml里
[quote]<init-param>
<param-name>readonly</param-name>
<param-value>false</param-value>
</init-param> [/quote]
•接下来,从客户端通过 Ajax XMLHTTPRequest 发起 DELETE/PUT 请求:
[quote][javascript] view plaincopyprint?
01.function getXMLHTTPRequest(){
02. if (XMLHttpRequest) {
03. return new XMLHttpRequest();
04. } else {
05. try{
06. return new ActiveXObject('Msxml2.XMLHTTP');
07. }catch(e){
08. return new ActiveXObject('Microsoft.XMLHTTP');
09. }
10. }
11.}
12.var req = getXMLHTTPRequest();
13.req.open('DELETE','http://localhost/test.jsp',false);
14.req.send(null);
15.document.write(req.responseText);
function getXMLHTTPRequest(){
if (XMLHttpRequest) {
return new XMLHttpRequest();
} else {
try{
return new ActiveXObject('Msxml2.XMLHTTP');
}catch(e){
return new ActiveXObject('Microsoft.XMLHTTP');
}
}
}
var req = getXMLHTTPRequest();
req.open('DELETE','http://localhost/test.jsp',false);
req.send(null);
document.write(req.responseText); [/quote]
•WebDAV也需要使用到这2种Http请求方法。
其中delete,put在tomcat 里模式不支持,需要在web.xml里
[quote]<init-param>
<param-name>readonly</param-name>
<param-value>false</param-value>
</init-param> [/quote]
•接下来,从客户端通过 Ajax XMLHTTPRequest 发起 DELETE/PUT 请求:
[quote][javascript] view plaincopyprint?
01.function getXMLHTTPRequest(){
02. if (XMLHttpRequest) {
03. return new XMLHttpRequest();
04. } else {
05. try{
06. return new ActiveXObject('Msxml2.XMLHTTP');
07. }catch(e){
08. return new ActiveXObject('Microsoft.XMLHTTP');
09. }
10. }
11.}
12.var req = getXMLHTTPRequest();
13.req.open('DELETE','http://localhost/test.jsp',false);
14.req.send(null);
15.document.write(req.responseText);
function getXMLHTTPRequest(){
if (XMLHttpRequest) {
return new XMLHttpRequest();
} else {
try{
return new ActiveXObject('Msxml2.XMLHTTP');
}catch(e){
return new ActiveXObject('Microsoft.XMLHTTP');
}
}
}
var req = getXMLHTTPRequest();
req.open('DELETE','http://localhost/test.jsp',false);
req.send(null);
document.write(req.responseText); [/quote]
•WebDAV也需要使用到这2种Http请求方法。