前台:
var url = "filter.do?action=filter";
var xmlDocument = XmlDocument.create();
var filterInfo = xmlDocument.createElement("filterInfo");
xmlDocument.appendChild(filterInfo);
appendSimpleChildNode(xmlDocument, filterInfo, "type", type);
appendSimpleChildNode(xmlDocument, filterInfo, "condition", condition);
xmlHttp = XmlHttp.create();
xmlHttp.open("POST", url, false);
xmlHttp.send(xmlDocument.xml);
var xmlString = xmlHttp.responseText;
return xmlString;
后台:
SAXBuilder saxb = new SAXBuilder();
Document doc = saxb.build(request.getInputStream());
Element root = doc.getRootElement();
String type = root.getChildText("type");
String inputCondition = root.getChildText("condition");