国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

angular.js - How to parse angular's Ajax request in the background?
PHPz
PHPz 2017-05-15 16:50:07
0
3
993

The data sent by angular’s ??Ajax request is
Object {Account: "123", Password: "123"}
How to parse and read in JAVA background? Ordinary methods will not work...

PHPz
PHPz

學(xué)習(xí)是最好的投資!

reply all(3)
黃舟

If it is json, read it as a stream and parse it into a json object

If it is a key value pair, use querystring/form to get the value based on the key

key value pair : http://stackoverflow.com/questions/11442632/how-can-i-post-data-as-form-data-instead-of-a-request-payload

parse json : http://vitalflux.com/angularjs-post-json-data-using-ajax-springmvc/

我想大聲告訴你

Since the background MVC cannot parse the value
Try using request.getParameter("pName") in the most common servlet class to see if you can get it?
If you can get it using the servlet class
It should just be a configuration problem when using that MVC framework,
If even the servlet class cannot get the parameters, use the browser's developer tools to check whether the ajax request was sent successfully
Or is it a problem like whether the sent data turns into a string?

世界只因有你

I use angularjs in the frontend and springmvc in the backend. When the frontend makes a request to the backend, it uses JSON.stringify(data), and the backend controller uses (@RequestBody User user) to receive parameters.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template