Java implements the JSON back-end to transfer data to the front-end

1 back end two auxiliary classes

ConcurrentDateUtil. Java, used to generate the format we need

JsonResult. Java, jsonresult encapsulation, used to transfer data from the back end to the front end

After the above two classes are completed, we can use jsonresult in the controller of the web layer to encapsulate the data and pass it to the front end.

Next, let's introduce two cases to see how the front end gets data

2 how does the front-end JS fetch data

If the jsonresult passed from the back end to the front end encapsulates a map, for example

Now, what should I do if I want to get the two data of the signed in number and the total number of people from the front-end JS? You just need to be in "." Just follow the key of the map, as shown below:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>