A method, device, readable storage medium and electronic equipment for server-side rendering

By adding explicit identifiers and implicitly processing the dynamic data of the server-side rendered page, the problem of low rendering page update efficiency in existing technologies is solved, enabling efficient modification and updating of dynamic data and improving the efficiency of page rendering.

CN116089751BActive Publication Date: 2025-12-16CHINA TELECOM NETWORK SECURITY TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211663542.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-23
Publication Date
2025-12-16
Estimated Expiration
2042-12-23

AI Technical Summary

Technical Problem

Existing server-side rendering technologies lack efficient methods for modifying rendered pages when some content is updated, forcing developers to modify database data and redeploy the server, resulting in low efficiency.

Method used

By adding explicit identifiers to dynamic data and performing implicit processing, implicit identifiers are generated, ensuring that the client can modify dynamic data without affecting the rendering logic, thus achieving efficient updates to the rendered page.

Benefits of technology

Without affecting the server-side rendering logic and client-side applicability, it enables efficient modification of dynamic data, improves the update efficiency of rendered pages, and avoids the inefficient operation of repeatedly deploying the server.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116089751B_ABST
    Figure CN116089751B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a server-side rendering method and device, a readable storage medium and an electronic device to avoid the problem of low efficiency and high cost caused by re-modifying interface data and redeploying the server in the prior art. The method comprises: determining dynamic data in a first to-be-rendered file by a server; wherein the dynamic data indicates information of at least one interface; adding an explicit identifier to a key-value pair in the dynamic data at a first preset position to obtain a second to-be-rendered file; wherein the explicit identifier corresponds to the key-value pair one by one; performing implicit processing on the explicit identifier to obtain an implicit identifier invisible to a client and a third to-be-rendered file including the implicit identifier; and rendering the third to-be-rendered file to obtain a rendered file.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of page rendering, and in particular to a server-side rendering method and device, a readable storage medium and an electronic device. BACKGROUND

[0002] SSR (Server side render) refers to a manner in which, after receiving a request from a client, a server generates an html string by using a rendering engine such as ejs, jsp, jade, and the like, and then sends the html string to the client (for example, a browser), so that the client directly presents a webpage upon receiving the html file sent by the server without any additional operation. Please refer to Figure 1 Compared with CSR (Client side render), SSR can avoid the problem of slow homepage loading caused by the client requesting interface data and inserting the data by itself.

[0003] However, for SSR, in the face of scenarios in which part of the content in a rendered page needs to be changed due to updates or the like, for example, scenarios in which a PDF report is generated by using an html file, or scenarios in which part of the data or charts needs to be fine-tuned, the only way is to seek help from a developer. After the developer modifies the data in a database, the server is re-deployed, so that the server re-performs SSR. Therefore, in the existing SSR technology, there is a lack of an efficient method for modifying a rendered page. SUMMARY

[0004] The present application provides a server-side rendering method, device, readable storage medium and electronic device to avoid the problem of low efficiency and high cost caused by re-modifying interface data and re-deploying a server in the prior art.

[0005] In a first aspect, the present application provides a server-side rendering method, comprising:

[0006] The server determines dynamic data in a first to-be-rendered file; wherein the dynamic data indicates information of at least one interface;

[0007] An explicit identifier is added to a key-value pair in the dynamic data at a first preset position, to obtain a second to-be-rendered file; wherein the explicit identifier corresponds to the key-value pair one by one;

[0008] The explicit identifier is implicitly processed to obtain an implicit identifier that is invisible to the client, and a third to-be-rendered file including the implicit identifier;

[0009] The third to-be-rendered file is rendered to obtain a rendered file.

[0010] The server-side rendering method provided in the embodiments of the present application adds an identification invisible to the client to the dynamic data, so that the purpose of marking the dynamic data is achieved without affecting the server-side rendering logic and the client, ensuring that the client can exclude static data when needed and query the dynamic data supporting editing in time, thereby achieving the purpose of efficiently modifying the rendered page (rendered file).

[0011] In a possible implementation, the implicit processing of the explicit identification is zero-width character conversion processing.

[0012] In a possible implementation, the adding of the explicit identification to the key-value pair in the dynamic data at the first preset position to obtain the second to-be-rendered file comprises:

[0013] determining the explicit identification corresponding to the value of the key-value pair based on a preset algorithm; wherein the preset algorithm comprises a hash algorithm;

[0014] taking the explicit identification as a suffix of the key-value pair to obtain the second to-be-rendered file.

[0015] In a possible implementation, after the rendered file is obtained, the method further comprises:

[0016] receiving modification data sent by the client; wherein the modification data comprises a first explicit identification or a first implicit identification, and a first key-value pair corresponding to the first explicit identification, the first implicit identification corresponding to the first explicit identification in one-to-one manner; the first key-value pair is dynamic data modified by the client;

[0017] in response to the modification data comprising the first implicit identification and the first key-value pair, decompiling the first implicit identification, determining a modification object in the second to-be-rendered file based on the first explicit identification obtained by the decompilation, modifying the modification object based on the first key-value pair to obtain a second key-value pair, and an updated second to-be-rendered file; or,

[0018] in response to the modification data comprising the first explicit identification and the first key-value pair, determining the modification object in the second to-be-rendered file based on the first explicit identification, and modifying the modification object based on the first key-value pair to obtain the second key-value pair and the updated second to-be-rendered file; wherein the updated second to-be-rendered file comprises the second key-value pair;

[0019] rendering the updated second to-be-rendered file to obtain an updated rendered file.

[0020] In a possible implementation, the first explicit identifier is determined based on the first explicit identifier, the modification object is determined in the second file to be rendered based on the first explicit identifier, the second key-value pair is obtained by modifying the modification object based on the first key-value pair, and the updated second file to be rendered includes:

[0021] The first explicit identifier is determined in the modification data based on a preset position relationship between the explicit identifier and the key-value pair.

[0022] In the second file to be rendered, the key-value pair to be modified corresponding to the first explicit identifier is determined as the modification object, and the value in the key-value pair to be modified is modified to the value of the first key-value pair to obtain the second key-value pair.

[0023] In a possible implementation, the value in the key-value pair to be modified is modified to the value of the first key-value pair to obtain the second key-value pair, including:

[0024] The first key-value pair in the modification data is compared with the key-value pair to be modified in the second file to be rendered.

[0025] In response to the first key-value pair being different from the key-value pair to be modified, the value of the key-value pair to be modified is modified by using the value of the first key-value pair to obtain the second key-value pair.

[0026] In a second aspect, an embodiment of the present application further provides a method for server-side rendering, including:

[0027] The client determines the implicit identifier in the rendering file based on a mouseover event and a preset identifier, and a position relationship between the preset identifier and the implicit identifier, wherein the first rendering file is an html file for proxying the mouseover event, and the preset identifier is used to mark the implicit identifier and only supports mouseover event query.

[0028] According to a preset position relationship between the implicit identifier and a key-value pair, a key-value pair supporting editing is determined, and the value of the key-value pair supporting editing is modified to obtain a first key-value pair.

[0029] The first key-value pair and the implicit identifier, or the first key-value pair and an explicit identifier obtained by decompiling the implicit identifier, are sent to the server, so that the server determines and modifies back-end data corresponding to the first key-value pair based on the explicit identifier, wherein the explicit identifier is in one-to-one correspondence with a key-value pair of dynamic data of the server.

[0030] An updated rendering file sent by the server is received, wherein the updated rendering file includes a second key-value pair in one-to-one correspondence with the first key-value pair.

[0031] In a possible implementation, the first key-value pair and the implicit identifier, or the first key-value pair and the explicit identifier obtained by decompiling the implicit identifier, are sent to the server, so that the server determines and modifies the backend data corresponding to the first key-value pair based on the explicit identifier, including:

[0032] The first key-value pair and the implicit identifier are sent to the server, so that the server decompiles the implicit identifier, and determines and modifies the backend data corresponding to the first key-value pair according to the explicit identifier obtained by decompiling; or,

[0033] The implicit identifier is decompiled to obtain an explicit identifier corresponding to the key-value pair supported by the editing, and the first key-value pair and the explicit identifier are sent to the server, so that the server determines the backend data corresponding to the first key-value pair based on the explicit identifier.

[0034] In a third aspect, the embodiments of the present application further provide a server-side rendering device, including:

[0035] A determination unit is configured to determine dynamic data in a first to-be-rendered file, wherein the dynamic data indicates information of at least one interface;

[0036] An explicit unit is configured to add an explicit identifier to a key-value pair in the dynamic data at a first preset position to obtain a second to-be-rendered file, wherein the explicit identifier corresponds to the key-value pair one by one.

[0037] An implicit unit is configured to perform implicit processing on the explicit identifier to obtain an implicit identifier invisible to a client and a third to-be-rendered file including the implicit identifier.

[0038] A rendering unit is configured to render the third to-be-rendered file to obtain a rendered file.

[0039] In a possible implementation, the explicit unit is specifically configured to determine the explicit identifier corresponding to the value of the key-value pair based on a preset algorithm, wherein the preset algorithm includes a hash algorithm; and the explicit identifier is taken as a suffix of the key-value pair to obtain the second to-be-rendered file.

[0040] In a possible implementation, the server-side rendering apparatus further includes an updating unit, which is specifically configured to receive modification data sent by the client; the modification data includes a first explicit identifier or a first implicit identifier, and a first key-value pair corresponding to the first explicit identifier, the first implicit identifier corresponds to the first explicit identifier in one-to-one manner; the first key-value pair is dynamic data modified by the client; in response to the modification data including the first implicit identifier and the first key-value pair, the first implicit identifier is decompiled, and based on the first explicit identifier obtained by the decompiling, a modification object is determined in the second to-be-rendered file, the modification object is modified based on the first key-value pair, a second key-value pair and an updated second to-be-rendered file are obtained; or,

[0041] in response to the modification data including the first explicit identifier and the first key-value pair, based on the first explicit identifier, a modification object is determined in the second to-be-rendered file, and the modification object is modified based on the first key-value pair, to obtain a second key-value pair and an updated second to-be-rendered file; the updated second to-be-rendered file includes the second key-value pair; the updated second to-be-rendered file is rendered to obtain an updated rendered file.

[0042] In a possible implementation, the updating unit is specifically configured to determine the first explicit identifier in the modification data based on a preset position relationship between the explicit identifier and the key-value pair; in the second to-be-rendered file, a to-be-modified key-value pair corresponding to the first explicit identifier is determined as the modification object, and a value in the to-be-modified key-value pair is modified to a value of the first key-value pair to obtain the second key-value pair.

[0043] In a possible implementation, the updating unit is further configured to compare the first key-value pair in the modification data and the to-be-modified key-value pair in the second to-be-rendered file; in response to the first key-value pair being different from the to-be-modified key-value pair, a value of the to-be-modified key-value pair is modified by using a value of the first key-value pair to obtain the second key-value pair.

[0044] In a fourth aspect, the embodiments of the present application further provide a server-side rendering apparatus, which includes:

[0045] The identifier unit is configured to determine the implicit identifier in the rendered file based on a mouseover event, a preset identifier, and a position relationship between the preset identifier and the implicit identifier; the first rendered file is an html file for proxying the mouseover event; the preset identifier is used to mark the implicit identifier, and the preset identifier only supports mouseover event query.

[0046] The modification unit is configured to determine a key-value pair supporting editing according to the preset position relationship between the implicit identifier and the key-value pair, and modify the value of the key-value pair supporting editing to obtain a first key-value pair.

[0047] The sending unit is configured to send the first key-value pair and the implicit identifier, or the first key-value pair and an explicit identifier obtained by decompiling the implicit identifier, to the server, so that the server determines and modifies back-end data corresponding to the first key-value pair based on the explicit identifier; the explicit identifier corresponds to a key-value pair of dynamic data of the server in a one-to-one manner.

[0048] The receiving unit is configured to receive an updated rendering file sent by the server; the updated rendering file includes a second key-value pair corresponding to the first key-value pair in a one-to-one manner.

[0049] In a possible implementation, the sending unit is specifically configured to send the first key-value pair and the implicit identifier to the server, so that the server decompiles the implicit identifier, and determines and modifies the back-end data corresponding to the first key-value pair according to an explicit identifier obtained by the decompilation; or, the sending unit is specifically configured to decompile the implicit identifier to obtain an explicit identifier corresponding to the key-value pair supporting editing, and send the first key-value pair and the explicit identifier to the server, so that the server determines the back-end data corresponding to the first key-value pair based on the explicit identifier.

[0050] In a fifth aspect, an embodiment of the present application further provides a readable storage medium, comprising,

[0051] a memory,

[0052] The memory is configured to store instructions, when the instructions are executed by the processor, the apparatus comprising the readable storage medium completes the method in the first aspect to the second aspect and any possible implementation.

[0053] In a sixth aspect, an embodiment of the present application further provides an electronic device, comprising:

[0054] a memory configured to store a computer program,

[0055] a processor configured to execute the computer program stored in the memory, so as to realize the method in the first aspect to the second aspect and any possible implementation. BRIEF DESCRIPTION OF DRAWINGS

[0056] Figure 1 A data link diagram for server-side rendering suitable for an embodiment of the present application;

[0057] Figure 2A flowchart of a method for server-side rendering provided by an embodiment of the present application is shown in the figure.

[0058] Figure 3 A structural diagram of a server-side rendering device provided by an embodiment of the present application is shown in the figure.

[0059] Figure 4 A structural diagram of an electronic device for server-side rendering provided by an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION

[0060] To solve the problem that it is difficult to efficiently modify a rendered page when server-side rendering is performed in the prior art, a method for server-side rendering is provided by an embodiment of the present application. The server sets an identifier for uniquely identifying dynamic data in a to-be-rendered file, and performs rendering after the identifier is invisibly processed. This solves the problem that, in the prior art, the document data that can be modified cannot be identified in the source code of a web page, so that the relevant data cannot be modified on the client side.

[0061] The method for server-side rendering provided by the embodiment of the present application can achieve the purpose of marking dynamic data while avoiding the influence of the identifier on the rendering logic or user operation, so as to easily find the dom (document) node supporting the contentEditable attribute in the source code, and enable the user to directly adjust or modify the rendered file on the client side, thereby avoiding the problem of low modification efficiency caused by the re-modification of all backend data and the deployment of the server in the prior art.

[0062] To better understand the above technical solution, the technical solution of the present application is described in detail below by means of the accompanying drawings and specific embodiments. It should be understood that the specific features in the embodiments of the present application and the embodiments are detailed descriptions of the technical solution of the present application, and are not limitations of the technical solution of the present application. In the case of no conflict, the technical features in the embodiments of the present application and the embodiments can be combined with each other.

[0063] Please refer to Figure 2 The present application provides a method for server-side rendering to improve the efficiency of modifying a rendered page. The method specifically includes the following implementation steps.

[0064] Step 201: The server determines the dynamic data in a first to-be-rendered file.

[0065] The dynamic data indicates the information of at least one interface, that is, the dynamic data is actually the interface data of one or more interfaces.

[0066] Step 202: An explicit identifier is added to the key-value pair in the dynamic data at a first preset position, to obtain a second to-be-rendered file.

[0067] The explicit identifier is in one-to-one correspondence with the key-value pair. The key-value pair comprises a key and a value corresponding to the key.

[0068] The first preset position is actually used to indicate the relative position relationship between the key-value pair and the explicit identifier in the dynamic data.

[0069] When the explicit identifier is added, the first preset position of the added explicit identifier should be adjacent to the key-value pair instead of being looked up in the key-value pair, so as to avoid affecting the rendering logic. The first preset position may be, for example, a prefix position or a suffix position of the key-value pair. When the dynamic data is modified, the value in the key-value pair in the dynamic data is generally modified, that is, the value in (key, value) is modified, instead of the key closely related to the rendering logic. Therefore, the first preset position is preferably a suffix position of the key-value pair.

[0070] The following describes the addition of the explicit identifier: first, the explicit identifier corresponding to the key-value pair is determined based on a preset algorithm. The preset algorithm comprises a hash algorithm, and then the explicit identifier is taken as a suffix of the key-value pair to obtain a second to-be-rendered file. To record the one-to-one correspondence between the key-value pair and the explicit identifier in the second to-be-rendered file, the second to-be-rendered file can be persistently stored.

[0071] Further, the following describes the generation of the explicit identifier. To ensure the uniqueness of the explicit identifier, leaf nodes that cannot be iterated continuously in the dynamic data are first queried and traversed, so as to obtain a difference factor. Then, the leaf nodes are processed by using a preset algorithm to obtain a unique explicit identifier. The explicit identifier can be composed of a hash identifier obtained by using a hash algorithm and the difference factor. The preset algorithm can comprise a salt strategy and a hash algorithm. The difference factor is the "salt", which corresponds to the number of executions / levels of iteration to the leaf nodes.

[0072] When the leaf nodes are determined, the depth-first traversal or the breadth-first traversal can be performed by using a recursive manner. The depth-first traversal is suitable for a structure tree with a large number of leaf nodes and a small number of sibling nodes, and the breadth-first traversal is more suitable for a structure tree with a small number of leaf nodes and a large number of sibling nodes. The Json structure tree in which the dynamic data is located has the characteristics of a large number of child nodes and a small number of sibling nodes, so the depth-first traversal is preferably performed by using a recursive manner for the Json structure tree to determine the leaf nodes in the embodiment of the application.

[0073] After the leaf nodes are determined, the difference factor can be first determined by using a salt strategy. In the embodiment of the application, the current traversal level is set as the "salt", that is, the current traversal level (number of times) is taken as the difference factor. The number of levels corresponding to "0" is set to be in a period of cycle from "0" to "500000".

[0074] Further, the key of the key-value pair at the leaf node (i.e., key) is concatenated with the value, or the array index of the leaf node is concatenated with the value in the key-value pair at the leaf node to obtain the hash identifier.

[0075] The difference factor and the hash identifier are concatenated in a preset order to obtain the explicit identifier. The preset order can be that the difference factor is in the front and the hash identifier is in the rear. The preset order can also be that the hash identifier is in the front and the difference factor is in the rear.

[0076] Step 203: Perform invisible processing on the explicit identifier to obtain an implicit identifier invisible to the client and a third to-be-rendered file including the implicit identifier.

[0077] Actually, the explicit identifier and the implicit identifier are both visible to the server, i.e., explicit. In order to avoid any identifier affecting the presentation of the rendered page, i.e., in order to make the identifier invisible to the user, the explicit identifier is subjected to invisible processing on the server to obtain an implicit identifier invisible to the client.

[0078] That is, the explicit identifier and the implicit identifier are mainly for the client, and especially the implicit identifier is invisible to the client.

[0079] The above-mentioned invisible processing manner can be zero-width character conversion processing. For the client, the zero-width character is hidden and not displayed, and is also a non-printable unicode character. The zero-width character described in the embodiments of the present application includes but is not limited to non-breaking space, zero-width no ligature, zero-width ligature, and the like. The conversion of the zero-width character is described below: first, split the explicit identifier to obtain single characters. The same processing is performed on each single character: first, convert the single character to an ASCII code in hexadecimal; then convert the ASCII code to binary and save it in a separate array.

[0080] Step 204: Perform rendering on the third to-be-rendered file to obtain a rendered file.

[0081] The rendered file is an html file sent to the client.

[0082] In the rendering, the rendering engine used in the embodiments of the present application includes but is not limited to ejs, jsp, jade, and the like.

[0083] Specifically, after sending the rendering file to the client, the user may encounter a scenario when browsing the rendering file on the client, for example, in an internationalized site implementation, an operator finds a translation that can be optimized in the webpage and intends to modify the translation; for example, before generating a PDF from the html, the user checks the rendering file (page) and finds that it needs to be modified. Thus, the client makes modifications in such scenarios and re-sends the modified rendering file (containing modification data and explicit identification) or the uncompiled rendering file (containing modification data and implicit identification) to the server after decompilation, so as to achieve the purpose of real-time updating of the client, thereby ensuring that the modified rendering page (file) is always opened again.

[0084] After obtaining the rendering file and sending it to the client, the modification data received from the client (i.e., sent by the client) can be directly re-rendered according to the modification data, thereby achieving the purpose of efficiently modifying the rendering page. The following will be described in detail:

[0085] First, receive the modification data sent by the client. The modification data is the Json data decompiled by the client. The modification data is divided into two types according to whether the client decompiles the identified implicit identification: the first explicit identification or the first implicit identification, and the first key-value pair corresponding to the first explicit identification. The first type of modification data includes the first explicit identification and the first key-value pair corresponding to the first explicit identification. The second type includes the first implicit identification and the first key-value pair corresponding to the first implicit identification. Moreover, the first implicit identification corresponds to the first explicit identification one-to-one; the first key-value pair is the dynamic data modified by the client. Obviously, the client modifies the value in the first key-value pair.

[0086] Then, in response to the modification data including the first implicit identification and the first key-value pair, first decompile the first implicit identification to obtain the first explicit identification. Then, based on the first explicit identification obtained by decompilation and the one-to-one correspondence between the explicit identification and the key-value pair, determine the modification object in the second rendering file to be rendered, modify the aforementioned modification object based on the first key-value pair to obtain the second key-value pair, and update the second rendering file to be rendered; or,

[0087] In response to the modification data including the first explicit identification and the first key-value pair, the modification object corresponding to the first explicit identification can be directly determined in the aforementioned saved second rendering file to be rendered based on the one-to-one correspondence between the explicit identification and the key-value pair and the first explicit identification, and the modification object is modified based on the first key-value pair to obtain the second key-value pair and the updated second rendering file including the second key-value pair.

[0088] Specifically, when the dynamic data is modified, the rendering logic other than the dynamic data, including the relative position relationship between the rendering logic and the explicit identifier, will not change. Therefore, the first explicit identifier or the first implicit identifier can be determined in the modified data based on the preset position relationship between the explicit identifier and the key-value pair. If the first explicit identifier cannot be obtained for searching, or multiple searches fail, the first implicit identifier is confirmed, and then the first explicit identifier obtained through the decompilation is used to search in the second to-be-rendered file. When searching, the search can also be performed based on the position relationship between the explicit identifier and the dynamic data key-value pair to avoid the problem of low search efficiency caused by full-text search. For example, the preset position relationship is a suffix, and the search is directly performed from the end of each key-value pair. For example, the storage structure is: data:{value: '23.3k_hexXXX'}. When searching, the search is directly performed from the end of the value, a substring with the length of "hexXXX" is found, and comparison is performed, that is, only the suffix "hexXXX" is compared. The first explicit identifier obtained by searching in the second to-be-rendered file is the to-be-modified key-value pair before the first explicit identifier, which is the aforementioned modification object. Therefore, the value in the to-be-modified key-value pair can be modified to the value of the first key-value pair, and the second key-value pair can be obtained. The to-be-modified key-value pair is at least the same as the first key-value pair before modification.

[0089] To avoid unnecessary server modification and repeated rendering, the to-be-modified key-value pair and the first key-value pair can also be compared after the to-be-modified key-value pair is determined. In response to the to-be-modified key-value pair being different from the first key-value pair, the value of the first key-value pair is used to modify (that is, overwrite) the value of the to-be-modified key-value pair to obtain the aforementioned second key-value pair.

[0090] Finally, after the second key-value pair is obtained, that is, the updated second to-be-rendered file is obtained, the updated second to-be-rendered file is rendered to obtain an updated rendering file. The updated rendering file is still an html file.

[0091] Embodiments of the present application also provide a server-side rendering method applied to a client, which will be described below:

[0092] First, the client determines an implicit identifier in a rendering file based on a mouseover event and a preset identifier, and a position relationship between the preset identifier and the implicit identifier.

[0093] The preset identifier is used to mark the implicit identifier, and the preset identifier only supports mouseover event query (readable) and is also invisible to the client. For example, "segment" is only visible to the mouseover event. The rendering file is an html file that proxies the mouseover event.

[0094] The aforementioned preset identifier can be set before the implicit identifier. For example, {segment+stroZero width(hidddenText)} is equivalent to "preset identifier + implicit identifier".

[0095] Secondly, based on the preset positional relationship between the implicit identifier and the key-value pairs, the editable key-value pairs are determined. For example, if the preset positional relationship is that the implicit identifier is located at the suffix of the key-value pair, then the editable key-value pairs can be determined before the implicit identifier. The value of these editable key-value pairs is then modified to obtain the first modified key-value pair; that is, the DOM element whose contentEditable property is editable.

[0096] Furthermore, the first key-value pair, along with the implicit identifier, or the first key-value pair, along with the explicit identifier obtained by decompiling the implicit identifier, is sent to the server, so that the server can determine the backend data corresponding to the first key-value pair based on the explicit identifier. This backend data is the data to be modified.

[0097] It should be noted that the execution subject of the decompilation is not restricted in the embodiments of this application. That is, the decompilation of the implicit identifier can be synchronized with the modification of the key-value pair on the client side, or the modified key-value pair and the implicit identifier can be sent to the server side together for decompilation by the server side.

[0098] Therefore, when the client decompiles the implicit identifier, before sending the modified data—that is, while the client queries the implicit identifier (e.g., a zero-width character) based on the mouseover event—it also decompiles the found implicit identifier to obtain the explicit identifier that corresponds one-to-one with the aforementioned first key-value pair. This explicit identifier also corresponds one-to-one with the dynamic data in the server-side file to be rendered.

[0099] In other words, the modified data consisting of the first key-value pair and the implicit identifier, or the modified data consisting of the first key-value pair and the explicit identifier obtained by decompiling the implicit identifier, is sent to the server so that the server can determine and modify the backend data corresponding to the first key-value pair based on the explicit identifier.

[0100] Finally, the updated render file sent by the server is received. This updated render file includes a second key-value pair corresponding to the first key-value pair modified on the client side. This second key-value pair is identical to the first key-value pair.

[0101] Based on the same inventive concept, this application provides a server-side rendering device, which is similar to the aforementioned... Figure 2 The rendering method shown corresponds to the method described above. For a detailed implementation of this device, please refer to the description in the aforementioned method embodiment section. Repeated descriptions will not be repeated here. Figure 3 The microcontroller in this device includes:

[0102] The determining unit 301 is configured to determine, by a server, dynamic data in a first to-be-rendered file.

[0103] The dynamic data indicates information of at least one interface.

[0104] The explicit unit 302 is configured to add, at a first preset position, an explicit identifier to a key-value pair in the dynamic data, to obtain a second to-be-rendered file.

[0105] The explicit identifier corresponds to the key-value pair in a one-to-one manner.

[0106] The explicit unit 302 is specifically configured to determine, based on a preset algorithm, the explicit identifier corresponding to a value of the key-value pair, wherein the preset algorithm includes a hash algorithm; and add the explicit identifier as a suffix of the key-value pair, to obtain the second to-be-rendered file.

[0107] The implicit unit 303 is configured to perform implicit processing on the explicit identifier, to obtain an implicit identifier that is invisible to a client, and a third to-be-rendered file including the implicit identifier.

[0108] The implicit processing on the explicit identifier refers to zero-width character conversion processing on the explicit identifier.

[0109] The rendering unit 304 is configured to render the third to-be-rendered file, to obtain a rendered file.

[0110] The device for server-side rendering further includes an updating unit, which is specifically configured to receive modification data sent by a client, wherein the modification data includes a first explicit identifier and a first key-value pair corresponding to the first explicit identifier, the first key-value pair being dynamic data modified by the client; determine, based on the first explicit identifier, a modification object in the second to-be-rendered file, and modify the modification object based on the first key-value pair, to obtain a second key-value pair and an updated second to-be-rendered file; wherein the updated second to-be-rendered file includes the second key-value pair; and render the updated second to-be-rendered file, to obtain an updated rendered file.

[0111] The updating unit is specifically configured to determine, based on a preset positional relationship between the explicit identifier and the key-value pair, the first explicit identifier in the modification data; in the second to-be-rendered file, determine a to-be-modified key-value pair corresponding to the first explicit identifier as the modification object, and modify a value in the to-be-modified key-value pair to a value of the first key-value pair, to obtain the second key-value pair.

[0112] The updating unit is further configured to compare the first key-value pair in the modification data and the to-be-modified key-value pair in the second to-be-rendered file; and in response to the first key-value pair being different from the to-be-modified key-value pair, modify the value of the to-be-modified key-value pair by using the value of the first key-value pair, to obtain the second key-value pair.

[0113] Further, based on the same inventive concept, the embodiments of the present application also provide a server-side rendering device, which comprises:

[0114] The identification unit is configured to determine the implicit identifier in the rendering file based on the mouseover event and the preset identifier, and the positional relationship between the preset identifier and the implicit identifier; the first rendering file is an html file for proxying the mouseover event; and the preset identifier is used for marking the implicit identifier, and the preset identifier only supports mouseover event query.

[0115] The modification unit is configured to determine the key-value pair supporting editing according to the preset positional relationship between the implicit identifier and the key-value pair, and modify the value of the key-value pair supporting editing to obtain the first key-value pair.

[0116] The sending unit is configured to send the first key-value pair and the implicit identifier, or the first key-value pair and the explicit identifier obtained by decompiling the implicit identifier to the server, so that the server determines and modifies the back-end data corresponding to the first key-value pair based on the explicit identifier.

[0117] The sending unit is specifically configured to send the first key-value pair and the implicit identifier to the server, so that the server decompiles the implicit identifier, and determines and modifies the back-end data corresponding to the first key-value pair according to the explicit identifier obtained by the decompiling; or decompile the implicit identifier to obtain the explicit identifier corresponding to the key-value pair supporting editing, and send the first key-value pair and the explicit identifier to the server, so that the server determines the back-end data corresponding to the first key-value pair based on the explicit identifier.

[0118] The receiving unit is configured to receive the updated rendering file sent by the server; and the updated rendering file comprises a second key-value pair corresponding to the first key-value pair.

[0119] Based on the same inventive concept, the embodiments of the present application also provide a readable storage medium, which comprises:

[0120] a memory,

[0121] The memory is configured to store instructions which, when executed by the processor, cause the apparatus comprising the readable storage medium to perform the rendering method of the server as described above.

[0122] Based on the same inventive concept as the rendering method of the server described above, the embodiments of the present application also provide an electronic device which can implement the functions of the rendering method of the server as described above. Please refer to Figure 4 , the electronic device comprises:

[0123] at least one processor 401 and a memory 402 connected with the at least one processor 401, and the specific connection medium between the processor 401 and the memory 402 is not limited in the embodiments of the present application, Figure 4 In the embodiments of the present application, the connection between the processor 401 and the memory 402 is taken as an example of connection through a bus 400. The bus 400 is represented by a thick line in Figure 4 , and the connection mode between other components is only schematically illustrated and is not limited. The bus 400 can be divided into an address bus, a data bus, a control bus, etc., and for the convenience of representation, Figure 4 In the embodiments of the present application, only one thick line is used to represent the bus 400, but it does not mean that there is only one bus or only one type of bus. Alternatively, the processor 401 can also be referred to as a controller, and the name is not limited.

[0124] In the embodiments of the present application, the memory 402 stores instructions executable by the at least one processor 401, and the at least one processor 401 can execute the rendering method of the server as discussed above by executing the instructions stored in the memory 402. The processor 401 can implement the functions of various modules in the apparatus as shown in Figure 3 .

[0125] The processor 401 is the control center of the apparatus, and can connect various parts of the entire control device through various interfaces and lines, and perform overall monitoring on the apparatus by running or executing the instructions stored in the memory 402 and calling the data stored in the memory 402, thereby processing various functions and data of the apparatus.

[0126] In a possible design, the processor 401 can include one or more processing units, and the processor 401 can integrate an application processor and a modem processor, wherein the application processor mainly processes operating systems, user interfaces, and application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also be not integrated into the processor 401. In some embodiments, the processor 401 and the memory 402 can be implemented on the same chip, and in some embodiments, they can also be implemented on independent chips respectively.

[0127] The processor 401 can be a general processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic component, a discrete hardware component, and can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general processor can be a microprocessor or any conventional processor. The steps of the rendering method of the server disclosed in the embodiments of the present application can be directly embodied by the hardware processor for execution, or executed by a combination of hardware and software modules in the processor.

[0128] The memory 402 is a non-volatile computer readable storage medium, which can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 402 can include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. The memory 402 is any other medium capable of carrying or storing desired program code in the form of instructions or data structures and capable of being accessed by a computer, but is not limited thereto. The memory 402 in the embodiments of the present application can also be a circuit or any other device capable of realizing a storage function, used to store program instructions and / or data.

[0129] By designing and programming the processor 401, the code corresponding to the rendering method of the server in the foregoing embodiments can be fixed into the chip, so that the chip can execute the steps of the rendering method of the server at runtime. Figure 2 How to design and program the processor 401 is a technology known to those skilled in the art, which will not be described here.

[0130] Those skilled in the art can clearly understand that, for the convenience and brevity, only the division of the above functional modules is taken as an example, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0131] In several embodiments provided by the present application, it should be understood that the disclosed device and method can be implemented by other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules or units is only a logical function division, and there can be another division way in actual implementation, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0132] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0133] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0134] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or the whole or part of the technical solutions that essentially contribute to the prior art can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the method described in various embodiments of the present application. The aforementioned storage medium includes a universal serial bus flash disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0135] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application also intends to include these modifications and variations.

Claims

1. A method of server-side rendering, the method comprising: The method comprises: A server determines dynamic data in a first to-be-rendered file; wherein the dynamic data indicates information of at least one interface; An explicit identifier is added to a key-value pair in the dynamic data at a first preset position to obtain a second to-be-rendered file; wherein the explicit identifier corresponds to the key-value pair in a one-to-one manner; The explicit identifier is implicitly processed to obtain an implicit identifier that is invisible to a client and a third to-be-rendered file including the implicit identifier; The third to-be-rendered file is rendered to obtain a rendered file; Modification data sent by the client is received; wherein the modification data includes a first explicit identifier or a first implicit identifier, and a first key-value pair corresponding to the first explicit identifier; the first implicit identifier corresponds to the first explicit identifier in a one-to-one manner; the first key-value pair is dynamic data modified by the client; In response to the modification data including the first implicit identifier and the first key-value pair, the first implicit identifier is decompiled, and a modification object is determined in the second to-be-rendered file based on the first explicit identifier obtained by the decompiling, the modification object is modified based on the first key-value pair to obtain a second key-value pair, and an updated second to-be-rendered file is obtained; or In response to the modification data including the first explicit identifier and the first key-value pair, the modification object is determined in the second to-be-rendered file based on the first explicit identifier, and the modification object is modified based on the first key-value pair to obtain the second key-value pair and the updated second to-be-rendered file; wherein the updated second to-be-rendered file includes the second key-value pair; The updated second to-be-rendered file is rendered to obtain an updated rendered file.

2. The method of claim 1, wherein, The implicit processing of the explicit identifier refers to zero-width character conversion processing of the explicit identifier.

3. The method of claim 1, wherein, The adding of the explicit identifier to the key-value pair in the dynamic data at the first preset position to obtain the second to-be-rendered file comprises: Based on a preset algorithm, the explicit identifier corresponding to the value of the key-value pair is determined; wherein the preset algorithm includes a hash algorithm; The explicit identifier is taken as a suffix of the key-value pair to obtain the second to-be-rendered file.

4. The method of claim 1, wherein, The determining of the modification object in the second to-be-rendered file based on the first explicit identifier, and the modification of the modification object based on the first key-value pair to obtain the second key-value pair and the updated second to-be-rendered file comprises: The first explicit identifier is determined in the modification data based on a preset positional relationship between the explicit identifier and the key-value pair; In the second to-be-rendered file, a to-be-modified key-value pair corresponding to the first explicit identifier is determined as the modification object, and a value in the to-be-modified key-value pair is modified to a value of the first key-value pair to obtain the second key-value pair.

5. The method of claim 4, wherein, The modification of the value in the to-be-modified key-value pair to the value of the first key-value pair to obtain the second key-value pair comprises: The first key-value pair in the modification data and the to-be-modified key-value pair in the second to-be-rendered file are compared; In response to the first key value being different from the to-be-modified key value pair, a value of the first key value pair is used to modify a value of the to-be-modified key value pair, to obtain the second key value pair.

6. A method of server-side rendering, the method comprising: The method comprises the following steps: The client determines the implicit identifier in a rendering file based on a mouseover event and a preset identifier, and a preset position relationship between the preset identifier and the implicit identifier; the rendering file is an html file in which the mouseover event is proxied; the preset identifier is used to mark the implicit identifier, and the preset identifier only supports mouseover event query; According to a preset position relationship between the implicit identifier and a key value pair, a key value pair supporting editing is determined, and a value of the key value pair supporting editing is modified to obtain a first key value pair; The first key value pair and the implicit identifier are sent to a server, so that the server decompiles the implicit identifier, and determines and modifies back-end data corresponding to the first key value pair according to an explicit identifier obtained through the decompilation; or The implicit identifier is decompiled to obtain an explicit identifier corresponding to the key value pair supporting editing, and the first key value pair and the explicit identifier are sent to the server, so that the server determines the back-end data corresponding to the first key value pair based on the explicit identifier; the explicit identifier is in one-to-one correspondence with a key value pair of dynamic data of the server; An updated rendering file sent by the server is received; the updated rendering file comprises a second key value pair in one-to-one correspondence with the first key value pair.

7. An apparatus for server-side rendering, the apparatus comprising: The method comprises the following steps: A determination unit is configured to determine, by a server, dynamic data in a first to-be-rendered file; the dynamic data indicates information of at least one interface; An explicit unit is configured to add, at a first preset position, an explicit identifier to a key value pair in the dynamic data to obtain a second to-be-rendered file; the explicit identifier is in one-to-one correspondence with the key value pair; An implicit unit is configured to perform implicit processing on the explicit identifier to obtain an implicit identifier invisible to a client, and a third to-be-rendered file comprising the implicit identifier; A rendering unit is configured to render the third to-be-rendered file to obtain a rendering file; An updating unit is configured to receive modification data sent by the client; the modification data comprises a first explicit identifier or a first implicit identifier, and a first key value pair corresponding to the first explicit identifier; the first implicit identifier is in one-to-one correspondence with the first explicit identifier; the first key value pair is dynamic data modified by the client; in response to the modification data comprising the first implicit identifier and the first key value pair, the first implicit identifier is decompiled, and a modification object is determined in the second to-be-rendered file based on the first explicit identifier obtained through the decompiling; the modification object is modified based on the first key value pair to obtain a second key value pair and an updated second to-be-rendered file; or In response to the modification data including the first explicit identifier and the first key-value pair, determining the modification object in the second to-be-rendered file based on the first explicit identifier, and modifying the modification object based on the first key-value pair to obtain the second key-value pair, and the updated second to-be-rendered file; wherein the updated second to-be-rendered file includes the second key-value pair; rendering the updated second to-be-rendered file to obtain an updated rendered file.

8. An apparatus for server-side rendering, the apparatus comprising: Comprise: An identification unit: configured to determine the implicit identifier in a rendered file based on a mouseover event and a preset identifier, and a preset position relationship between the preset identifier and the implicit identifier; wherein the rendered file is an html file for proxying the mouseover event; the preset identifier is used to mark the implicit identifier, and the preset identifier only supports mouseover event query; A modification unit: configured to determine an editable key-value pair according to a preset position relationship between the implicit identifier and the key-value pair, and modify the value of the editable key-value pair to obtain a first key-value pair; A sending unit: configured to send the first key-value pair and the implicit identifier to a server, so that the server decompiles the implicit identifier, and determines and modifies the back-end data corresponding to the first key-value pair according to the explicit identifier obtained by the decompilation; or, decompile the implicit identifier to obtain an explicit identifier corresponding to the editable key-value pair, and send the first key-value pair and the explicit identifier to the server, so that the server determines the back-end data corresponding to the first key-value pair based on the explicit identifier; wherein the explicit identifier corresponds one-to-one to the key-value pair of the dynamic data of the server; A receiving unit: configured to receive an updated rendered file sent by the server; wherein the updated rendered file includes a second key-value pair corresponding one-to-one to the first key-value pair.

9. A readable storage medium, characterized by, Comprise, a memory, The memory is used to store instructions, when the instructions are executed by the processor, the device comprising the readable storage medium completes the method as claimed in any one of claims 1-6.

10. An electronic device, comprising: Comprise: a memory, for storing computer programs; a processor, configured to execute the computer programs stored on the memory, to realize the method as claimed in any one of claims 1-6.

Citation Information

Patent Citations

  • Browser page rendering method and device, electronic equipment and storage medium

    CN113051503A

  • Rendering method and device of tree control, computer equipment and storage medium

    CN114840293A

  • Method and apparatus in mark-up language documents for providing mark-up language hidden attributes

    US20020078051A1