Still using JSON to complete AJAX, switch to Beetl bar (top)

Source: Internet
Author: User

Browser through AJAX, the server returns JSON data, no refresh of the updated view of this mode in web development I have been used for a long time, remember the earliest was 08, when the transfer of JSON data let me light. This approach is only required to use a toolkit to serialize the model into JSON format, the JS UI Library can always recognize this format, easily generate new view segment.

But the passage of the passage . This way of passing Ajax JSON is getting new problems.
    1. The JSON serialization library is not able to serialize model objects perfectly. The serialization library always expects to enter an object, but in practice the front end may need more than one object, so that you have to create a serialized private object. In addition, the serialization logic is simple, which is to serialize all object properties. Although JSON Lib can provide attribute filtering, attribute formatting, and so on, but ask yourself, far less than the template rendering function perfect. The template language provides rich statements and extensions to handle model objects. In addition, the JSON Lib in the serialized object is referenced to each other, processing is not good. In the template language, this will not be a problem. In summary, developers have to create new view objects in order to serialize the JSON, and have to hack into the original model to specify serialization logic. In my opinion, the best Fastjson tools are listed, and you can see the various developers asking questions (i ba la down from the Fastjson forum line).

-When using Fastjson to map, how to let the value of NULL in Map equals ""?
-fastjson 1.2.4 Date type ISO8601 format serialization problem ...
-@jsontype annotations are recommended to add the allows property, allowing you to set the number of properties allowed to serialize (I also recommend other annotation for controlling rendering logic-busy)
-Fastjson support escape, prevent XSS?

2 with the development of front-end technology, programmers no longer need to easyui,extjs this front-end framework. Because this framework is not visual-centric, it is impossible for the visual staff to influence the framework. Now the more popular way is the template way, only through the front-end template engine to complete: the input is the JSON and front-end template, the output is the updated DOM. So the question is, is it not as good as the direct back-end template engine rendering? Why bother serializing to JSON and then rendering with the weaker front-end template engine. A bit of Shejinqiuyuan taste.

3 for some sites that need SEO, using AJAX json is a fatal problem, because the search engine picked up a shell. Very unfriendly. There is no way to improve it at present. It is said that Google has a special simulator to simulate

4 for a complex page, if more than one part of the AJAX request, this is simply the life of the Web server. Now the server is not afraid of CPU busy, afraid to request more. So the Ajax JSON approach is also very bad, and there is no way to improve it at the moment.

spit out so much Ajax JSON, should say beetl how to solve, please listen to tell

Still using JSON to complete AJAX, switch to Beetl bar (top)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.