Ajax submit xml to servlet

xiaoxiao2021-04-01  227

Page JS as follows

function postXML () {if (window.XMLHttpRequest) req = new XMLHttpRequest (); else if (window.ActiveXObject) req = new ActiveXObject ( "Microsoft.XMLHTTP"); else return; req.open ( "POST", "http : // LocalHost: 8080 / MPS / ORDERS.DO? Action = save "); Req.SetRequestHeader ('Content-Type', 'Text / XML'); Req.onReadyStateChange = XMLposted; Req.send (ORDERDOC); Function Xmlposted () {if (Req.ReadyState! = 4) Return; if (Req.status == 200) {var result = req.responsexml; Alert ("Records Saved SuccessFully);} else {}}

Backstage Action

SAXReader Reader = New SaxReader (); Document Doc = Reader.Read (Request.getInputStream ());

转载请注明原文地址:https://www.9cbs.com/read-131233.html

New Post(0)