ConnectionTest.html
<html>
<head>
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../../ext-all.js"></script>
<script language="javascript" type="text/javascript">
var conn=new Ext.data.Connection({
listeners : {
beforerequest : function(){alert("beforeRequest")},
requestcomplete : function(){alert("Complete Request ")},
requestexception : function(){alert("Request Exception")}
},
url : "http://127.0.0.1:8080/CommonWeb/jsonData.jsp",
timeout : 30000,
autoAbort : false ,
defaultHeaders : {
"Mys'name" : "Dangzhao",
"Mys'sex" : "Old boy~"
},
disableCaching : true ,
extraParams : {
"Id" : "0",
"Action" : "Insert"
},
method : "GET"
});
conn.request({
success : sucessFn,
failure : failureFn
});
function sucessFn(response, param ){
alert("Sucess")
alert(response.responseText)
alert(param)
}
function failureFn(response, param ){
alert("Failure")
alert(response.responseText)
alert(param)
}
</script>
</head>
<body>
</body>
</html>
jsonData.jsp
<%@page import="java.util.*" %>
Hi,Please replace here json or xml data
<%
Enumeration enm=request.getHeaderNames();
while(enm.hasMoreElements()){
String key=(String)enm.nextElement();
System.out.println(key+":"+request.getHeader(key));
}
Map p=request.getParameterMap();
Iterator it=p.keySet().iterator();
while(it.hasNext()){
String key=(String)it.next();
System.out.println(key+":"+((String[])p.get(key))[0]);
}
%>
System.out.....
Accept:*/*
Accept-Language:zh-cn
mys'name:Dangzhao
Referer:file://E:\ext-2.0.2\ext-2.0.2\examples\grid\ConnectionTest.html
x-requested-with:XMLHttpRequest
mys'sex:Old boy~
Accept-Encoding:gzip, deflate
User-Agent:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
Host:127.0.0.1:7001
Connection:Keep-Alive
Cookie:2=1; 74=1; 145=0; 80=1; 102=1; JSESSIONID=LpJS1DHh!-1296687579
Action:Insert
_dc:1209981558125
Id:0