ExtJS POST请求客户端服务端案例

客户端GUI端示例
var positionIDList = [1,2,3,4];
Ext.Ajax.request({
	method: 'POST',
    url: 'services/test',
    jsonData: {
    	'positionIDList':positionIDList,
    	'date':'20151110'
    },
    writer:'json',
    success: function(response, opts) {
        var obj = Ext.decode(response.responseText);
    },
    failure: function(response, opts) {
    	console.log('Operation failure');
    }
});


服务端RESTful方法示例:
@POST
@Path("/test")
public int test(LinkedHashMap<String, Object> params) {
	String date = (String) params.get("date");
	List<Map<String, String>> positionIDRawList = (List<Map<String, String>>) params.get("positionIDList");
}

你可能感兴趣的:(REST,post,Restful,ExtJs,请求)