2020/9/3 Daily: Use Ajax to realize paging query

learning target

Using Ajax to realize paging query


Learning Content

Shang Silicon Valley SSM framework actual combat, ssm integration tutorial


Learning output

• 1. Visit the index.jsp page
• 2. The index.jsp page sends out a query request
• 3. The Controller layer accepts the request and
finds out the data • 4. Comes to the list.jsp page to display the
above method is only suitable for browsing The interaction model between the server and the server.


Ajax

The json data returned by Ajax is suitable for various clients such as andriod, ios, etc. It will be more convenient to parse them.

The key elements of Ajax include the following:
① JavaScript language: the main development language of Ajax technology.
② XML/JSON/HTML, etc.: data format used to encapsulate requests or responses
③ DOM (Document Object Model): modify page elements through DOM attributes or methods to achieve partial page refresh
④ CSS: change styles, beautify page effects, and improve users Experience
⑤ Ajax engine: the XMLHttpRequest object, which transmits data between the client and the server in an asynchronous manner.

The relationship between ajax and jquery, json

bug

Problem Description

  1. When the project interacts with ajax and the background, the ajax of the foreground has not received the json data of the packaging object returned by the background controller, and the conversion of java objects and json objects has been reporting errors.

java.lang.IllegalArgumentException: No converter found for return value of type
2. JQuery代码提示Unresolved function or method $()问题


Cause Analysis

  1. The error is that there is no converter for this type of value, but the @responseBody annotation will automatically encapsulate the returned data into json format, and the front desk cannot receive the json object. It should be a json package version conflict problem.

  2. The jar package that did not import the response


solution

  1. When the springMVC version uses 4.X, Jackson needs to use the 2.X version, and the core components of Jackson are different at this time. The core components are:
    core components include: jackson-annotations, jackson-core, jackson-databind,
    Import these three packages separately, or introduce dependencies in pom.xml.
    Insert picture description here

  2. Import the jar package
    Maven remote warehouse JQuery corresponding jar package

Guess you like

Origin blog.csdn.net/qq1350975694/article/details/108391698