A multi-page interaction method and system based on JSON technology
By implementing multi-page interaction through a public object file based on JSON technology, the memory overflow problem caused by multi-page loading is solved, improving page response speed and user experience.
Patent Information
- Application Number
- CN202110510869.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-11
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2041-05-11
AI Technical Summary
Existing technologies suffer from slow loading and loading failures in multi-page interactive applications, especially when displaying multiple sub-tables, where memory overflow causes page loading failures.
By creating a public JSON object file based on JSON technology, all the data needed for the page can be stored, enabling interaction between multiple pages. Only a single HTML page needs to be loaded, and the JSON object can be used for page initialization, data modification, and formula calculation.
It improves page response speed, avoids slow page loading and freezing, and enhances user experience.
Smart Images

Figure CN113312882B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer application technology, and more specifically, to a multi-page interaction method and system based on JSON technology. Background Art
[0002] With the development of computer software technology, more and more new technologies are applied to the field of e-government. As an old product in the field of government software, the declaration project uses the plug-in of Huabiao for report display function. Because the technology is too old, it has many conflicts with some new projects of the tax bureau. Based on this, the need to use pure HTML to develop the interface came into being. However, since a tax type requires multiple schedules, it is necessary to load multiple HTML pages when displaying a tax type, especially in the case of many schedules such as general people and income tax annual reports, the page will load slowly or even fail to load. The reason is that too many pages are loaded in the memory, resulting in memory overflow.
[0003] JSON (Java Script Object Notation) is a lightweight data exchange format. It is based on a subset of Java Script (Standard ECMA-2623rd Edition-December1999). JSON uses a text format that is completely independent of the language, but also uses C-like conventions. These features make JSON an ideal data exchange language that is easy for people to read and write, and easy for machines to parse and generate.
[0004] Prior art 1 (Application name: Multi-page switching method, device, terminal device and storage medium, Application number: 201810014131.3) discloses: the parent page obtains a page jump instruction; the parent page calls the page interaction method function of the JavaScript object shared by the child page based on the page jump instruction. However, the prior art does not emphasize that multiple pages share data through json public variable strings and calculate formulas between different pages.
[0005] Prior art 2 (Application name: A multi-page interaction method, device, terminal and storage medium based on building block programming, Application number: 201911249321.4) discloses: solving the problem that the complex business logic of the interaction of multiple designed form pages in the existing building block programming technology is difficult and the reference hierarchy is unclear. However, the prior art does not emphasize that multiple pages share data through json public variable strings and calculate formulas between different pages.
[0006] Therefore, a technology is needed to optimize multi-page interactive applications. Summary of the invention
[0007] The technical solution of the present invention provides a method and system for multi-page interaction based on JSON technology to solve the problem of how to optimize multi-page interaction.
[0008] In order to solve the above problems, the present invention provides a method for multi-page interaction based on JSON technology, the method comprising:
[0009] Obtain an XML format message, and convert the XML format message into a CLL format message;
[0010] Convert the cll format message into a json format object file, wherein the json format object file includes form nodes of all schedules;
[0011] The content of the currently opened page is set through the json format object file to initialize the currently opened page;
[0012] After modifying the page data of the currently opened page, the content of the json object file corresponding to the form node in the json format object file is synchronously modified;
[0013] When a new page needs to be switched, the page data of the currently opened page is assigned to the json format object file.
[0014] Preferably, it includes: converting the cll format message into a json format object file by xslt method.
[0015] Preferably, when a new page needs to be switched, the page data of the currently opened page is assigned to the json format object file, and it also includes: setting the content of the page opened after switching through the json format object file, and initializing the page opened after switching.
[0016] Preferably, the method further comprises: assigning a value of 0 or null to a form node having no value in the json format object file.
[0017] Preferably, the page is an HTML format page; the number of pages opened is one.
[0018] Preferably, when formula calculations between different pages are involved, the content of the form node of the json format object file is modified synchronously.
[0019] According to another aspect of the present invention, the present invention provides a multi-page interaction system based on JSON technology, the system comprising:
[0020] An acquisition unit, used for acquiring an XML format message, and converting the XML format message into a CLL format message;
[0021] Establishing a unit, used for converting the cll format message into a json format object file, wherein the json format object file includes form nodes of all schedules;
[0022] The initialization unit is used to set the content of the currently opened page through the json format object file to initialize the currently opened page;
[0023] An execution unit, used for modifying the page data of the currently opened page, and synchronously modifying the content of the json object file corresponding to the form node in the json format object file;
[0024] The switching unit is used to assign the page data of the currently opened page to the json format object file when a new page needs to be switched.
[0025] Preferably, the establishing unit is also used to convert the cll format message into a json format object file through xslt.
[0026] Preferably, the switching unit is used to assign the page data of the currently opened page to the json format object file when a new page needs to be switched, and is also used to: set the content of the page opened after switching through the json format object file to initialize the page opened after switching.
[0027] Preferably, the initialization unit is also used to assign a value of 0 or null to a form node without a value in the json format object file.
[0028] Preferably, the page is an HTML format page; the number of pages opened is one.
[0029] Preferably, the execution unit is also used to synchronously modify the content of the form node of the json format object file when formula calculations between different pages are involved.
[0030] The technical solution of the present invention provides a method and system for multi-page interaction based on JSON technology, wherein the method includes: obtaining an XML format message, converting the XML format message into a CL format message; converting the CL format message into a JSON format object file, the JSON format object file includes the form nodes of all appendices; setting the content of the currently opened page through the JSON format object file, and initializing the currently opened page; after modifying the page data of the currently opened page, synchronously modifying the content of the JSON object file corresponding to the form node in the JSON format object file; when it is necessary to switch to a new page, assigning the page data of the currently opened page to the JSON format object file. The technical solution of the present invention is to provide a method in which pages can interact with each other during multi-page loading, improve the page response speed, avoid slow loading and stuck phenomenon of pages due to too many pages, and improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] A more complete understanding of exemplary embodiments of the present invention may be obtained by referring to the following drawings:
[0032] Figure 1 A flowchart of a method for multi-page interaction based on JSON technology according to a preferred embodiment of the present invention; and
[0033] Figure 2 This is a system structure diagram of multi-page interaction based on JSON technology according to a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0034] Now, exemplary embodiments of the present invention are described with reference to the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. These embodiments are provided to disclose the present invention in detail and completely and to fully convey the scope of the present invention to those skilled in the art. The terms used in the exemplary embodiments shown in the accompanying drawings are not intended to limit the present invention. In the accompanying drawings, the same units / elements are marked with the same reference numerals.
[0035] Unless otherwise specified, the terms (including technical terms) used herein have the commonly understood meanings to those skilled in the art. In addition, it is understood that the terms defined in commonly used dictionaries should be understood to have the same meanings as those in the context of the relevant fields, and should not be understood as idealized or overly formal meanings.
[0036] Figure 1 This is a flow chart of a method for multi-page interaction based on JSON technology according to a preferred embodiment of the present invention. Figure 1As shown, in order to optimize the loading of multiple declaration pages and avoid memory overflow due to too many loaded pages, the present invention provides a multi-page interaction method based on json technology, the method comprising:
[0037] Step 101: Obtain an XML format message, and convert the XML format message into a CLL format message;
[0038] Step 102: converting the cll format message into a json format object file, wherein the json format object file includes form nodes of all appendices; preferably, including: converting the cll format message into a json format object file by using xslt.
[0039] The present invention is based on json technology, that is, a common json format object is created in the page, and all the filled-in data required in the page is saved through the json format object, so that the function of mutual interaction between multiple pages can be realized without loading all pages. The present invention first obtains the tax type initial message from Jinsan, and the message is in xml format. The received xml format file is converted into the original cll format message required on the page, which can be directly loaded into the corresponding field on the page. The present invention is illustrated by Jinsan tax declaration, but the implementation mode of the present invention is not limited to this.
[0040] Step 103: Setting the content of the currently opened page through a json format object file to initialize the currently opened page; preferably, it also includes: assigning a value of 0 or null to a form node that has no value in the json format object file.
[0041] The present invention converts the Cll format message generated in the above steps into an object file in json format, using the technology of xslt conversion. And in the process, the formula calculation required in the page loading process is realized. The json format object after the file conversion includes all the form nodes required in the attached table. The nodes without values are assigned 0 or empty.
[0042] Step 104: after modifying the page data of the currently opened page, the content of the json object file corresponding to the form node in the json format object file is synchronously modified;
[0043] Step 105: When a new page needs to be switched, the page data of the currently opened page is assigned to a json format object file.
[0044] Preferably, when a new page needs to be switched, the page data of the currently opened page is assigned to a json format object file, and the method further includes: setting the content of the page opened after the switch through the json format object file, and initializing the page opened after the switch.
[0045] Preferably, the page is an HTML format page; the number of pages opened is one.
[0046] Preferably, when formula calculations between different pages are involved, the contents of the form nodes of the json format object file are modified synchronously.
[0047] After entering the page, the present invention only needs to load a single html page. For example, currently loading the general person's schedule 1 page, the implementation method of the present invention realizes filling in the content in the schedule 1 interface, and needs to modify the formula in the main table at the same time. At this time, only the json object content generated in the previous step needs to be modified, which saves the page memory space. When the user switches the schedule, the data filled in the current page is assigned to the above-mentioned public json object. When displaying other pages, the content of the new page is loaded from the json object. The code of the present invention is exemplified as follows:
[0048] Enter the page to load content from a public json object and initialize it;
[0049] For page formula calculation, formula calculation between different pages: dataJsonFoHtml is a common json object. The formula calculation process is to adjust the content of the corresponding attribute value in the json object. When multiple pages are displayed at the same time before, the page dom content is modified. After the modification, the method operation should be simple.
[0050] When the page switches, the page data is assigned to the above public JSON object.
[0051] When the page is filled out, the declaration operation and verification operation are both obtained from the above public JSON format public variables. The original solution is to obtain from the page DOM object.
[0052] The embodiment of the present invention generates a common Json object when initializing the page, so that only a single HTML page needs to be loaded during the report filling process, thereby solving the problem of excessive memory space occupation when multiple pages are opened at the same time. The embodiment of the present invention realizes multi-page interaction through a common Json object, including formula calculation and value transmission, etc., solves the problem of slow page loading and jamming when loading multiple pages at the same time, and improves the user experience.
[0053] Figure 2 This is a system structure diagram of a multi-page interaction based on JSON technology according to a preferred embodiment of the present invention. Figure 2 As shown, the present invention provides a multi-page interaction system based on JSON technology, the system comprising:
[0054] The acquisition unit 201 is used to acquire the XML format message and convert the XML format message into a CLL format message;
[0055] The establishment unit 202 is used to convert the cll format message into a json format object file, the json format object file includes the form nodes of all appendices; preferably, the establishment unit is also used to convert the cll format message into a json format object file by xslt.
[0056] The present invention is based on json technology, that is, a common json format object is created in the page, and all the filled-in data required in the page is saved through the json format object, so that the function of mutual interaction between multiple pages can be realized without loading all pages. The present invention first obtains the tax type initial message from Jinsan, and the message is in xml format. The received xml format file is converted into the original cll format message required on the page, which can be directly loaded into the corresponding field on the page. The present invention is illustrated by Jinsan tax declaration, but the implementation mode of the present invention is not limited to this.
[0057] The initialization unit 203 is used to set the content of the currently opened page through a json format object file to initialize the currently opened page; preferably, the initialization unit 203 is also used to assign 0 or null to form nodes that have no value in the json format object file.
[0058] The present invention converts the Cll format message generated in the above steps into an object file in json format, using the technology of xslt conversion. And in the process, the formula calculation required in the page loading process is realized. The json format object after the file conversion includes all the form nodes required in the attached table. The nodes without values are assigned 0 or empty.
[0059] The execution unit 204 is used to modify the page data of the currently opened page and synchronously modify the content of the json object file corresponding to the form node in the json format object file;
[0060] The switching unit 205 is used to assign the page data of the currently opened page to the json format object file when a new page needs to be switched.
[0061] Preferably, the switching unit 205 is used to assign the page data of the currently opened page to a json format object file when a new page needs to be switched, and is also used to: set the content of the page opened after switching through the json format object file and initialize the page opened after switching.
[0062] Preferably, the page is an HTML format page; the number of pages opened is one.
[0063] Preferably, the execution unit 204 is also used to synchronously modify the content of the form node of the json format object file when formula calculations between different pages are involved.
[0064] After entering the page, the present invention only needs to load a single html page. For example, currently loading the general person's schedule 1 page, the implementation method of the present invention realizes filling in the content in the schedule 1 interface, and needs to modify the formula in the main table at the same time. At this time, only the json object content generated in the previous step needs to be modified, which saves the page memory space. When the user switches the schedule, the data filled in the current page is assigned to the above-mentioned public json object. When displaying other pages, the content of the new page is loaded from the json object. The code of the present invention is exemplified as follows:
[0065] Enter the page to load content from a public json object and initialize it;
[0066] For page formula calculation, formula calculation between different pages: dataJsonFoHtml is a common json object. The formula calculation process is to adjust the content of the corresponding attribute value in the json object. When multiple pages are displayed at the same time before, the page dom content is modified. After the modification, the method operation should be simple.
[0067] When the page switches, the page data is assigned to the above public JSON object.
[0068] When the page is filled out, the declaration operation and verification operation are both obtained from the above public JSON format public variables. The original solution is to obtain from the page DOM object.
[0069] The embodiment of the present invention generates a common Json object when initializing the page, so that only a single HTML page needs to be loaded during the report filling process, thereby solving the problem of excessive memory space occupation when multiple pages are opened at the same time. The embodiment of the present invention realizes multi-page interaction through a common Json object, including formula calculation and value transmission, etc., solves the problem of slow page loading and jamming when loading multiple pages at the same time, and improves the user experience.
[0070] The invention has been described above with reference to a few embodiments. However, it is readily apparent to a person skilled in the art that other embodiments than the ones disclosed above are equally within the scope of the invention, as defined by the appended patent claims.
[0071] Generally, all terms used in the claims are to be interpreted according to their ordinary meaning in the technical field, unless explicitly defined otherwise herein. All references to "a / / the [means, component, etc.]" are to be openly interpreted as at least one instance of a means, component, etc., unless explicitly stated otherwise. The steps of any method disclosed herein do not necessarily have to be performed in the exact order disclosed, unless explicitly stated otherwise.
Claims
1. A multi-page interaction method based on json technology, the method include: Obtain an XML format message, and convert the XML format message into a CLL format message; Convert the cll format message into a json format object file, wherein the json format object file includes form nodes of all schedules; The content of the currently opened page is set through the json format object file to initialize the currently opened page; After modifying the page data of the currently opened page, the content of the json object file corresponding to the form node in the json format object file is synchronously modified; When a new page needs to be switched, the page data of the currently opened page is assigned to the json format object file.
2. The method according to claim 1, include: The cll format message is converted into a json format object file by xslt.
3. According to the method of claim 1, when a new page needs to be switched, the page data of the currently opened page is assigned to the json format object file, and include: The content of the page opened after switching is set through the json format object file, and the page opened after switching is initialized.
4. The method according to claim 1, further comprising: include: The form nodes without values in the json format object file are assigned a value of 0 or empty.
5. The method according to claim 1, wherein the page is an HTML format page; and the number of pages opened is one.
6. According to the method of claim 1, when formula calculations between different pages are involved, the content of the form node of the json format object file is synchronously modified.
7. A multi-page interactive system based on json technology, the system include: An acquisition unit, used for acquiring an XML format message, and converting the XML format message into a CLL format message; Establishing a unit, used for converting the cll format message into a json format object file, wherein the json format object file includes form nodes of all schedules; The initialization unit is used to set the content of the currently opened page through the json format object file to initialize the currently opened page; An execution unit, used for modifying the page data of the currently opened page, and synchronously modifying the content of the json object file corresponding to the form node in the json format object file; The switching unit is used to assign the page data of the currently opened page to the json format object file when a new page needs to be switched.
8. According to the system of claim 7, the establishing unit is also used to convert the cll format message into a json format object file through xslt.
9. According to the system of claim 7, the switching unit is used to assign the page data of the currently opened page to the json format object file when it is necessary to switch to a new page, and is also used to: set the content of the page opened after switching through the json format object file, and initialize the page opened after switching.
10. According to the system of claim 7, the initialization unit is further used to assign a value of 0 or null to a form node without a value in the json format object file.
11. The system according to claim 7, wherein the page is an HTML format page; and the number of pages opened is one.
12. According to the system of claim 7, the execution unit is also used to synchronously modify the content of the form node of the json format object file when it involves formula calculation between different pages.
