<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Insert title here</title> <jsp:include flush="true" page="common/Extjs.jsp" /> <script type="text/javascript"> function test(){ Ext.Ajax.request({ url: '/StrutsExt/Ajax.action', // headers: { // 'userHeader': 'userMsg' // }, params: {}, method: 'GET', success: function (response, options) { var responseJson = Ext.JSON.decode(response.responseText); //alert(responseJson.success); //alert(options.url); Ext.MessageBox.alert('成功', '从服务端获取结果: ' + response.responseText); test(); }, failure: function (response, options) { test(); Ext.MessageBox.alert('失败', '请求超时或网络故障,错误编号:' + response.status); }, //callback: function (options, success, response) { //} }); } </script> </head> <body> <input type="button" value="测试" onclick="test()"/> </body> </html>