In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how SpringMVC handles Json data through Ajax". In daily operation, I believe many people have doubts about how SpringMVC handles Json data through Ajax. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how SpringMVC handles Json data through Ajax". Next, please follow the editor to study!
1. Preface:
Ajax:
Without reloading the whole page, refreshing parts of the page, such as giving likes, sending SMS CAPTCHA, and so on, can be realized through ajax. Ajax realizes the asynchronous refresh of the web page.
To achieve the effect, click the button, and the front end displays the student information sent from the background. This time we use Ajax in the form of jquery to complete it.
Second, use step 1. Introduction of jar
Jar:
Jackson-annotation.jar
Jackson-core.jar
Jackson-datebind.jar
If you do not use Maven, make sure that the version of the jar package is consistent when you introduce it, otherwise an exception will be thrown
2.Person class jar:jackson-annotation.jarjackson-core.jarjackson-datebind.jar3. Front-end page package com.lanqiao.entity;public class Person {private int id; private String name; private int age; public Person () {super (); / / TODO Auto-generated constructor stub} public Person (int id, String name, int age) {super (); this.id = id This.name = name; this.age = age;} public int getId () {return id;} public void setId (int id) {this.id = id;} public String getName () {return name } public void setName (String name) {this.name = name;} public int getAge () {return age;} public void setAge (int age) {this.age = age }} 4.ControllerInsert title here $(function () {$("# testJson") .click (function () {/ / request springmvc $.post (/ / requested server address "testJson" through Ajax) / / callback function function (result) {for (var iTun0) processed by the server I
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 235
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.