JavaWeb Ajax Programming (unreasonable)

1, AJAX

1.1Ajax definition Ajax: (asynchronous javascript and xml) Indicates JavaScript and XML.
Not a new programming language, but a technology for creating better and more interactive web applications, based on JavaScript, XML, HTML, CSS new usage.
AJAX: Only refreshes the local page
JavaScript: Update local web page
XML: Generally used to request data and response data
XMLHttpRequest object: Send request to server and get the return result
CSS: Beautifying page style
Asynchronous: Do not wait after sending requests, processing result by the callback function

2, JSON

2.1JSON definition JSON (JavaScript Object Notation) is a lightweight data exchange format. It makes it easy for people to read and write. It is also convenient for the machine to analyze and generate. JSON uses a text format completely independent of the program language, but also uses the habit of class C language. JSON is actually a subset of JavaScript, so JSON’s data format and JavaScript are corresponding.
2.2JSON Based on the two structures
JSON is simple to say that the objects and arrays in JavaScript, so these two structures are two structures of objects and arrays, which can be represented by both structures. Various complex structures. 1. Object: Objects Represents content in JS “{}”, the data structure is {key: value, key: value, …}, key value pair, in the object-oriented language In the property, key is the object, Value is the corresponding attribute value.
2, arrays: arrays in JS is brackets “[]”The content, the data structure is the same as [“Java”, “JavaScript”, “VB”, …], value, and all languages, using index acquisition, the type of field value can be a number, string, array Several objects.
2.3JS Built-in JSON Method

JSON.STRINGYFY ({}, [], “”) // Parameter 1: Data to serialize (Object) [OBJECT // Parameter 2: Control the key value of the object, just want to output the specified attribute, incoming an array
// parameter 3: After serialization, the format of the output is displayed (a Tab, which can be more intuitive JSON)
Any of JavaScript into JSON, is to sequence this object into a JSON string before passing it; receive a string of JSON format,
json.parse (json.data) / / Incoming JSON string
If we receive a string of JSON format, just reach it into a JavaScript object, you can use this object directly in JavaScript.
2.4 Precautions

1, JSON specifies the character set is UTF-8, the string must be used “”, the key of Object must also be used.
2, the last member of the array or object, cannot add a message. 3.1Fastjon Definition

Fastjson is a JSON parser and generator implemented by a well-behaved Java language, from Alibaba’s Engineer development. With extremely fast performance, beyond any other Java Json Parser.

3.3JSONArray introduction

3.4JSON object introduction
3.5Fastjson reverse sequence 1. Declined function
(1) json.ParseObject [JSON string is designed to java.class] (2) Json.Parsearray [reverse JSON string Sequence is java.util.list] 2. Customized reverse sequence step (1) Configure the reverse sequence using @jsonfield.
Br /> 2, custom reverse sequencer step (1) Configure the reverse sequence using @jsonfield. 3.6Fastjson Serialization

1, serialization function
jsonobject.tojsonstring ()

4, Apache Commons Introduction
<br/(2)使用ExtraProcessor和ExtraTypeProvider处理多余字段。
4.1 Apache Commons Tools
Apache Commons contains many open source tools that resolve problems that usually encounter frequently and reduce labor.
4.2Apache Commons Tool class Common Components

Tools for Java Basic Object Methods, such as: StringUtils, ArrayUtils, etc.

IO Tool package.

4.2.3Validate Provides a data verification framework for the client and server side.
4.2 .4fileUpload
Provides file upload function.

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment