CN111428170A - Web page rendering method and device - Google Patents

Web page rendering method and device Download PDF

Info

Publication number
CN111428170A
CN111428170A CN202010201225.9A CN202010201225A CN111428170A CN 111428170 A CN111428170 A CN 111428170A CN 202010201225 A CN202010201225 A CN 202010201225A CN 111428170 A CN111428170 A CN 111428170A
Authority
CN
China
Prior art keywords
data
primary key
page
interface
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010201225.9A
Other languages
Chinese (zh)
Other versions
CN111428170B (en
Inventor
康恺暄
方鸿灏
王亦男
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan MgtvCom Interactive Entertainment Media Co Ltd
Original Assignee
Hunan MgtvCom Interactive Entertainment Media Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan MgtvCom Interactive Entertainment Media Co Ltd filed Critical Hunan MgtvCom Interactive Entertainment Media Co Ltd
Priority to CN202010201225.9A priority Critical patent/CN111428170B/en
Publication of CN111428170A publication Critical patent/CN111428170A/en
Application granted granted Critical
Publication of CN111428170B publication Critical patent/CN111428170B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention relates to the technical field of computers, in particular to a web page rendering method and a web page rendering device. Acquiring place-occupied character strings in each data object contained in the service data source, replacing each place-occupied character string and each place-occupied character string corresponding to each data item through a macro replacement engine, acquiring final page structure data after modification, and rendering the web page through the final page structure data. By the method, the placeholders of the data items are replaced, so that the network data corresponding to the data items displayed after the web page is rendered are edited, and personalized customization is realized when the web page is rendered.

Description

Web page rendering method and device
Technical Field
The invention relates to the technical field of computers, in particular to a web page rendering method and device.
Background
With the development of computer technology, people can access various network data such as files, pictures, texts and the like in the internet through application programs such as browsers on various terminal devices. When a user requests to access network data on a browser, a web page corresponding to the network data is rendered through a page code corresponding to the page structure data, and the network data accessed by the user is displayed to the user through the web page.
The page structure data of the web page comprises static information and dynamic information, the static information is code information in the fixed page code, and the dynamic information is network data information obtained through an interface corresponding to the network data. When the web page needs to be rendered, the user can edit the static information, so that the page frame of the web page is changed. However, in the prior art, dynamic information in a web page cannot be edited, and personalized customization during rendering of the web page is limited.
Disclosure of Invention
In view of this, the present invention provides a web page rendering method, by which personalized customization of a web page can be realized when the web page is required to be rendered.
The invention also provides a web page rendering device used for ensuring the realization and application of the method in practice.
A web page rendering method, comprising:
when a page rendering request sent by a browser is received, acquiring initial page structure data of a web page to be rendered, wherein the page structure data comprises target data items corresponding to each network data to be displayed by the web page;
determining a docking interface corresponding to each target data item, and acquiring a target primary key name corresponding to each target data item in the initial page structure;
reading preset configuration information in the docking interface, and sending a docking request to the docking interface based on each target primary key name and the configuration information, so that the docking interface returns a service data source corresponding to each target primary key name according to the docking request; the business data source comprises a plurality of data objects, and each data object comprises a corresponding bit occupying string and a mapping primary key value;
determining placeholders corresponding to the target data items in the initial page structure data, calling a preset macro replacement engine according to the service data source and the initial page structure data, and replacing placeholder strings in the data objects with the placeholders to obtain final page structure data;
and inputting the final page structure data into a preset page rendering engine, obtaining a page code corresponding to the web page, sending the page code to the browser, and triggering the browser to render the web page according to the page code.
Optionally, the determining a docking interface corresponding to each target data item includes:
acquiring interface state information corresponding to each target data item contained in the initial page structure data;
judging whether the interface state information contains an opening state identifier or not; the starting state identifier represents the corresponding target data item starting interface docking function;
and if the interface state information contains an opening state identifier, acquiring interface data contained in the interface state information, and determining a docking interface corresponding to each target data item according to the interface data.
Optionally, the method for sending a docking request to the docking interface based on each target primary key name and the configuration information includes:
generating a primary key name set parameter containing each target primary key name according to each target primary key name, and acquiring an interface UR L address corresponding to the docking interface contained in the configuration information;
and sending a docking request carrying the primary key name set parameters to the docking interface based on the UR L address.
Optionally, in the method, the replacing the placeholder strings in the data objects and the placeholders by calling a preset macro replacement engine according to the service data source and the initial page structure data includes:
acquiring a mapping primary key value and a holding character string corresponding to each data object in the service data source;
matching each mapping primary key value with a target primary key name of each target data item, and establishing a one-to-one correspondence relationship between each mapping primary key value and each target primary key name;
and calling a preset macro replacement engine, and replacing each placeholder string and each placeholder based on the one-to-one correspondence between each mapping primary key value and each target primary key name.
Optionally, the method, after obtaining the page code corresponding to the web page, further includes:
and generating an HTM L document from the page code, and sending the HTM L document to the browser, so that the browser loads the HTM L document and renders the web page according to preset page rendering rules.
A web page rendering apparatus comprising:
the system comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring initial page structure data of a web page to be rendered when a page rendering request sent by a browser is received, and the page structure data comprises target data items corresponding to each network data to be displayed of the web page;
a determining unit, configured to determine a docking interface corresponding to each target data item, and obtain a target primary key name corresponding to each target data item in the initial page structure;
a sending unit, configured to read configuration information preset in the docking interface, and send a docking request to the docking interface based on each target primary key name and the configuration information, so that the docking interface returns a service data source corresponding to each target primary key name according to the docking request; the business data source comprises a plurality of data objects, and each data object comprises a corresponding bit occupying string and a mapping primary key value;
a replacing unit, configured to determine placeholders corresponding to the target data items in the initial page structure data, and according to the service data source and the initial page structure data, invoke a preset macro replacing engine to replace placeholder strings in the data objects with the placeholders, so as to obtain final page structure data;
and the rendering unit is used for inputting the final page structure data into a preset page rendering engine, acquiring a page code corresponding to the web page, sending the page code to the browser, and triggering the browser to render the web page according to the page code.
The above apparatus, optionally, the determining unit includes:
the first obtaining subunit is configured to obtain interface state information corresponding to each target data item included in the initial page structure data;
a judging subunit, configured to judge whether the interface state information includes an open state identifier; the starting state identifier represents the corresponding target data item starting interface docking function;
and the determining subunit is configured to, if the interface state information includes an open state identifier, acquire interface data included in the interface state information, and determine, according to the interface data, a docking interface corresponding to each target data item.
The above apparatus, optionally, the sending unit includes:
a generating subunit, configured to generate, according to each target primary key name, a primary key name set parameter including each target primary key name, and acquire an interface UR L address corresponding to the docking interface included in the configuration information;
a sending subunit, configured to send, to the docking interface, a docking request carrying the parameter of the primary key name set based on the UR L address.
The above apparatus, optionally, the replacing unit includes:
a second obtaining subunit, configured to obtain a mapping primary key value and a placeholder string corresponding to each data object in the service data source;
the matching subunit is configured to match each mapping primary key value with a target primary key name of each target data item, and establish a one-to-one correspondence between each mapping primary key value and each target primary key name;
and the replacing subunit is used for calling a preset macro replacing engine and replacing each placeholder string and each placeholder based on the one-to-one correspondence relationship between each mapping primary key value and each target primary key name.
The above apparatus, optionally, further comprises:
and the generating unit is used for generating an HTM L document from the page code and sending the HTM L document to the browser, so that the browser loads the HTM L document and renders the web page according to preset page rendering rules.
A storage medium comprising stored instructions, wherein the instructions, when executed, control a device on which the storage medium is located to perform the above-described web page rendering method.
An electronic device comprising a memory, and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by one or more processors to perform the method of web page rendering described above.
Compared with the prior art, the invention has the following advantages:
the invention provides a page rendering method, which comprises the following steps: when a page rendering request sent by a browser is received, acquiring initial page structure data of a web page to be rendered; determining a docking interface corresponding to each target data item, acquiring a target primary key name corresponding to each target data item in the initial page structure, reading preset configuration information in the docking interface, and sending a docking request to the docking interface based on each target primary key name and the configuration information, so that the docking interface returns a service data source corresponding to each target primary key name according to the docking request; determining placeholders corresponding to the target data items in the initial page structure data according to the service data source and the initial page structure data, calling a preset macro replacement engine, and replacing placeholder strings in the data objects with the placeholders to obtain final page structure data; and inputting the final page structure data into a preset page rendering engine, obtaining a page code corresponding to the web page, sending the page code to the browser, and triggering the browser to render the web page according to the page code. By applying the method provided by the invention, when the web page needs to be rendered, the service data source which needs to edit each data item in the web page is obtained by butting with the butting interface, the placeholder character string in each data object in the service data source is obtained, and each placeholder of each data item is replaced, so that the purpose of editing and replacing each data item is achieved, the network data displayed after the web page is rendered is edited network data, and personalized customization is realized when the web page is rendered.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method for rendering a page according to an embodiment of the present invention;
fig. 2 is a flowchart of another method of a page rendering method according to an embodiment of the present invention;
FIG. 3 is a flowchart of another method of a page rendering method according to an embodiment of the present invention;
fig. 4 is a device structure diagram of a page rendering device according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In this application, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions, and the terms "comprises", "comprising", or any other variation thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The invention is operational with numerous general purpose or special purpose computing device environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multi-processor apparatus, distributed computing environments that include any of the above devices or equipment, and the like.
An embodiment of the present invention provides a web page rendering method, which may be applied to multiple system platforms, where an execution subject of the method may be a page construction tool set in a processor of a computer terminal or various mobile devices, where the page construction tool is used to construct a web page, and a flowchart of the method is shown in fig. 1, and specifically includes:
s101: when a page rendering request sent by a browser is received, acquiring initial page structure data of a web page to be rendered, wherein the page structure data comprises target data items corresponding to each network data to be displayed by the web page;
in embodiments of the present invention, the page structure data is a software data structure that describes the information and structure of a web page. The web page contains a plurality of network data, such as files, pictures, texts, etc., and each network data exists in the form of data items in the page structure data. When a user needs to render a web page through a browser, a page rendering request can be sent to a processor through the browser, and after receiving the page rendering request, a page construction tool obtains initial page structure data of the web page.
It should be noted that the initial page structure data is the page structure data of the web page before editing, and in the present invention, modification and editing of the network data in the web page is realized by changing the data items in the initial page structure data.
S102: determining a docking interface corresponding to each target data item, and acquiring a target primary key name corresponding to each target data item in the initial page structure;
in the embodiment of the invention, in the process of constructing the new web page, the new web page needs to be constructed by a page construction tool. When the web page is constructed by the page construction tool, the docking interfaces corresponding to the target data items need to be determined.
The docking interface is a data interface through which a user needs to edit a web page to provide related data, and the user sets related data and codes corresponding to data items needing to be replaced, such as a place holding string, a mapping primary key name and the like, through the docking interface. The page construction tool can implement each data item in the page structure data according to the data provided by the interface.
S103: reading preset configuration information in the docking interface, and sending a docking request to the docking interface based on each target primary key name and the configuration information, so that the docking interface returns a service data source corresponding to each target primary key name according to the docking request; the business data source comprises a plurality of data objects, and a bit occupying string and a mapping primary key value which are respectively corresponding to each data object;
the method comprises the steps that configuration information is set by a user on a management platform and is associated with a docking interface, wherein the configuration information can comprise interface UR L addresses, attribute names, data types and the like.
Specifically, the service data source includes a plurality of data objects, and each data object may correspond to each target primary key name one to one. When a user needs to edit and modify a web page, a corresponding data object is set for target data corresponding to a target primary key name to be replaced, a place holder string to be replaced is stored in the data object, and a set formed by all the data objects is a service data source.
S104: determining placeholders corresponding to the target data items in the initial page structure data, calling a preset macro replacement engine according to the service data source and the initial page structure data, and replacing placeholder strings in the data objects with the placeholders to obtain final page structure data;
in the embodiment of the present invention, in the page structure data, each target data item has a corresponding placeholder, and the placeholder is used for placeholdering a position of the corresponding data item, and when new data needs to be replaced for the target data item or new data needs to be added to the target data item, a specified character can be replaced on the placeholder.
The characters in the placeholder corresponding to each target data item may be placeholders without any data characters, or may be placeholder strings originally edited by the last user on the web page. For example, if a commodity picture needs to be set at any blank position in the web page, the placeholder of the data item corresponding to the blank position of the commodity picture needs to be set as only one placeholder; and if a picture on the web page needs to be updated with a new picture, the placeholder of the data item corresponding to the position of the original picture is the placeholder string of the picture.
Specifically, the macro replacement engine is configured to replace the placeholder strings in each data object into the corresponding placeholders, so as to implement transformation of the page structure data and obtain the final page structure data.
S105: and inputting the final page structure data into a preset page rendering engine, obtaining a page code corresponding to the web page, sending the page code to the browser, and triggering the browser to render the web page according to the page code.
In the embodiment of the present invention, the page rendering engine is a code conversion tool for performing code conversion on the structure data, and when the final page structure data is obtained, the final page structure data needs to be converted into page codes. The browser can display the web page to the user by operating the page code, and simultaneously display the network data corresponding to each modified target data item on the web page.
In the method provided by the embodiment of the invention, when a user needs to edit and modify the content in the web page, configuration information of the web page needing to be edited and modified needs to be configured on the management platform in advance, and meanwhile, a business data source related to each content needing to be edited and modified is created on the docking interface and is docked by the web page. When the browser sends a page rendering request, acquiring initial page structure data of a web page to be rendered, and determining a docking interface corresponding to each target data item. And carrying out butt joint with a butt joint interface through the configuration information and the target primary key name of each target data item to obtain a service data source, and replacing the placeholders in the initial page structure data with the corresponding placeholder strings in each data object in the service data source through a macro replacement engine to realize the editing of the web page so as to obtain the final page structure data. And converting the final page structure data into page codes through a page rendering engine, and rendering the web page required by the user according to the page codes by the browser.
It should be noted that the page rendering engine is a tool for generating corresponding codes according to the input page structure data, and the web page rendering is realized by running the converted codes.
By applying the method provided by the embodiment of the invention, when the web page needs to be rendered, the service data source which needs to edit each data item in the web page is obtained by butting with the butting interface, the placeholder string in each data object in the service data source is obtained, and each placeholder of each data item is replaced, so that the purpose of editing and replacing each data item is achieved, the network data displayed after the web page is rendered is edited network data, and personalized customization during rendering of the web page is realized.
Specifically, based on the method provided in the foregoing embodiment, after the final page structure data is obtained, the final page structure data needs to be input into a preset page rendering engine to obtain a page code of a web page to be rendered. Before sending the page code to the browser for web page rendering, the method specifically includes:
and generating an HTM L document from the page code, and sending the HTM L document to the browser, so that the browser loads the HTM L document and renders the web page according to preset page rendering rules.
According to the web page rendering method provided by the embodiment of the invention, the page rendering rule can be CSS rule of cascading style sheet, when the browser needs to render the web page, the hypertext markup language HTM L code needs to be displayed in the browser window according to the rule defined by CSS, therefore, after the page code is obtained, an HTM L document needs to be generated, and the code in the HTM L document is the HTM L code, so that the browser can render the web page according to the rule defined by CSS after receiving the HTM L document.
The process of generating the HTM L document may also be generated by a page rendering engine.
In the method provided by the embodiment of the present invention, based on the content in step S102, the initial page structure data includes a plurality of data items, each data item may correspond to the same docking interface, and the docking interfaces corresponding to different data items may also be different. Specifically, as shown in fig. 2, the process of determining the docking interface corresponding to each target data item may specifically include:
s201: acquiring interface state information corresponding to each target data item contained in the initial page structure data;
in the embodiment of the present invention, the interface state information includes interface data information of the docking interface corresponding to each target data item, and an identifier of the current state of the interface.
S202: judging whether the interface state information contains an opening state identifier or not; the starting state identifier represents the corresponding target data item starting interface docking function;
in the embodiment of the present invention, in the interface state information, if the interface state information includes the open state identifier, it indicates that the network data in the current web page to be rendered needs to be modified, and needs to be docked with the docking interfaces corresponding to the target data items. And starting the interface docking function for each target data item, and further changing the identifier of the current state in the interface state information into an open state identifier.
Optionally, if the network data in the web page does not need to be modified, the identifier of the current state is the close state identifier.
S203: and if the interface state information contains an opening state identifier, acquiring interface data contained in the interface state information, and determining a docking interface corresponding to each target data item according to the interface data.
In the embodiment of the present invention, if the interface state information includes the open state identifier, it indicates that the network data in the current web page to be rendered needs to be modified, and needs to be docked with the docking interfaces corresponding to the target data items. And determining a docking interface needing to be docked by acquiring interface data in the interface state information.
In the method provided by the embodiment of the invention, whether each target data item in the initial page structure data needs to be modified or not is determined through the identifier of the current state in the interface state information. When the identifier of the current state in the interface state information is the open state identifier, the representation needs to be subjected to interface butt joint, and each target data item is modified, so that the modification of each network data in the web page is realized.
By applying the method provided by the embodiment of the invention, when the interface state information contains the opening state identifier, the docking interface needing to be docked can be determined through the interface data. By means of docking with the docking interface, a user dynamically modifies network data to be edited in the web page, and personalized customization during rendering of the web page is achieved.
In the method provided in the embodiment of the present invention, based on the content in step S103, after obtaining the configuration information of the docking interface, a process of sending a docking request to the docking interface based on each target primary key name and the configuration information may specifically include:
generating a primary key name set parameter containing each target primary key name according to each target primary key name, and acquiring an interface UR L address corresponding to the docking interface contained in the configuration information;
and sending a docking request carrying the primary key name set parameters to the docking interface based on the UR L address.
In the web page rendering method provided in the embodiment of the present invention, in the initial page structure data, each target data item corresponds to a target primary key name, for example, a picture is represented in the page structure data as a target data item, the representation form of the picture name corresponding to the picture in the initial page structure data is a target primary key name, and the target primary key name may be a name or a feature used for visualizing the target data item, such as an id and a name of the target data item.
The docking interface receives the HTTP request, analyzes the HTTP request to obtain each target main key name, and searches a data object corresponding to each target main key name according to each target main key name to generate a service data source for feedback.
By applying the method of the embodiment of the invention, the main key name set parameters generated by each target main key name and the UR L address of the interface send the docking request to the docking interface to obtain the service data source returned by the docking interface, thereby realizing the personalized customization of the web page.
In the method provided in the embodiment of the present invention, based on the content of step S104, the process of replacing the placeholder strings and the placeholders in the data objects by calling a preset macro replacement engine according to the service data source and the initial page structure data is as shown in fig. 3, and specifically may include:
s301: acquiring a mapping primary key value and a holding character string corresponding to each data object in the service data source;
in the embodiment of the invention, the service data source comprises a plurality of data objects, and each data object comprises a corresponding mapping primary key value and a occupation character string corresponding to the mapping primary key value.
The expression form of each mapping primary key value is consistent with that of each target primary key name, and each mapping primary key value represents a name or a feature for visualizing a data item, such as an id, a name, a feature identifier, and the like of a certain data item. The placeholder string is a code string of the data item that needs to be modified.
For example, in the initial page structure data, the target primary key name is name1 ═ a, and if the initial page structure data needs to be modified, in the business data source, the mapping primary key value corresponding to the target primary key name is also name1 ═ a.
S302: matching each mapping primary key value with a target primary key name of each target data item, and establishing a one-to-one correspondence relationship between each mapping primary key value and each target primary key name;
in the embodiment of the invention, the one-to-one correspondence between each mapping primary key value and each target primary key name is established by establishing the correspondence between the same id or name. Such as: the mapping primary key value is that a one-to-one correspondence relationship is established between the name1 and the target primary key name 1.
S303: and calling a preset macro replacement engine, and replacing each placeholder string and each placeholder based on the one-to-one correspondence between each mapping primary key value and each target primary key name.
In the embodiment of the invention, each data object corresponds to a mapping primary key value and a placeholder string respectively, and each target data item corresponds to a target primary key name and a placeholder respectively. Through the one-to-one correspondence relationship established between each mapping primary key value and each target primary key name, the one-to-one correspondence relationship between each data item and each data object can be determined, and the one-to-one correspondence relationship between each placeholder string and each placeholder exists. And replacing each occupation character string and each placeholder by the macro replacement engine according to the one-to-one correspondence relationship between each occupation character string and each placeholder.
In the web page rendering method provided by the embodiment of the invention, the one-to-one correspondence relationship between each target primary key name is determined according to the target primary key value in each data object, and each placeholder string and each placeholder are replaced through the correspondence relationship between each mapping primary key value and each target primary key name, so that the modification of the page structure data corresponding to the web page is realized, and the purpose of modifying the web page is achieved.
Specifically, after replacing each placeholder with each placeholder, the macro replacement engine changes the initial page structure data to obtain the final page structure data for feedback.
By applying the method provided by the embodiment of the invention, the macro replacement engine replaces each placeholder with each placeholder, the modification of the web page to be rendered before rendering is completed, and the personalized customization of the web page is realized.
The specific implementation procedures and derivatives thereof of the above embodiments are within the scope of the present invention.
Corresponding to the method described in fig. 1, an embodiment of the present invention further provides a web page rendering apparatus, which is used for implementing the method in fig. 1 specifically, the web page rendering apparatus provided in the embodiment of the present invention may be applied to a computer terminal or various mobile devices, and a schematic structural diagram of the web page rendering apparatus is shown in fig. 4, and specifically includes:
an obtaining unit 401, configured to obtain initial page structure data of a web page to be rendered when a page rendering request sent by a browser is received, where the page structure data includes target data items corresponding to network data to be displayed on the web page;
a determining unit 402, configured to determine a docking interface corresponding to each target data item, and obtain a target primary key name corresponding to each target data item in the initial page structure;
a sending unit 403, configured to read preset configuration information in the docking interface, and send a docking request to the docking interface based on each target primary key name and the configuration information, so that the docking interface returns a service data source corresponding to each target primary key name according to the docking request; the business data source comprises a plurality of data objects, and a bit occupying string and a mapping primary key value which are respectively corresponding to each data object;
a replacing unit 404, configured to determine placeholders corresponding to the target data items in the initial page structure data, and according to the service data source and the initial page structure data, call a preset macro replacing engine, replace the placeholder strings in the data objects with the placeholders, so as to obtain final page structure data;
and a rendering unit 405, configured to input the final page structure data into a preset page rendering engine, obtain a page code corresponding to the web page, send the page code to the browser, and trigger the browser to render the web page according to the page code.
In the web page rendering apparatus provided in the embodiment of the present invention, when a page rendering request is received, the obtaining unit obtains initial page structure data, and the determining unit determines a docking interface corresponding to each target data item in the initial page structure data. And sending a docking request to the docking interface by the sending unit according to the name of each target primary key and the configuration information of the docking interface so as to obtain a service data source. The method comprises the steps of obtaining each occupation character string from a service data source, replacing the occupation character string and the placeholder corresponding to each target data item by a replacing unit through calling a macro replacing engine, achieving the purpose of modifying the web page, finally obtaining final page structure data, inputting the final page structure data into a page rendering engine by a rendering unit, obtaining a page code of the web page, and rendering the web page by a browser according to the page code.
By applying the device provided by the embodiment of the invention, the sending unit is used for realizing the butt joint with the butt joint interface so as to obtain the service data source, so that the web page is modified according to the service data source, and the personalized customization of the web page is realized.
In the apparatus provided in the embodiment of the present invention, the determining unit 402 includes:
the first obtaining subunit is configured to obtain interface state information corresponding to each target data item included in the initial page structure data;
a judging subunit, configured to judge whether the interface state information includes an open state identifier; the starting state identifier represents the corresponding target data item starting interface docking function;
and the determining subunit is configured to, if the interface state information includes an open state identifier, acquire interface data included in the interface state information, and determine, according to the interface data, a docking interface corresponding to each target data item.
In the apparatus provided in the embodiment of the present invention, the sending unit 403 includes:
a generating subunit, configured to generate, according to each target primary key name, a primary key name set parameter including each target primary key name, and acquire an interface UR L address corresponding to the docking interface included in the configuration information;
a sending subunit, configured to send, to the docking interface, a docking request carrying the parameter of the primary key name set based on the UR L address.
In the apparatus provided in the embodiment of the present invention, the replacing unit 404 includes:
a second obtaining subunit, configured to obtain a mapping primary key value and a placeholder string corresponding to each data object in the service data source;
the matching subunit is configured to match each mapping primary key value with a target primary key name of each target data item, and establish a one-to-one correspondence between each mapping primary key value and each target primary key name;
and the replacing subunit is used for calling a preset macro replacing engine and replacing each placeholder string and each placeholder based on the one-to-one correspondence relationship between each mapping primary key value and each target primary key name.
The device provided by the embodiment of the invention further comprises:
and the generating unit is used for generating an HTM L document from the page code and sending the HTM L document to the browser, so that the browser loads the HTM L document and renders the web page according to preset page rendering rules.
The specific working processes of each unit and sub-unit in the web page rendering device disclosed in the above embodiment of the present invention may refer to corresponding contents in the web page rendering method disclosed in the above embodiment of the present invention, and are not described herein again.
The embodiment of the invention also provides a storage medium, which comprises a stored instruction, wherein when the instruction runs, the device where the storage medium is located is controlled to execute the web page rendering method.
An electronic device is provided in an embodiment of the present invention, and the structural diagram of the electronic device is shown in fig. 5, which specifically includes a memory 501 and one or more instructions 502, where the one or more instructions 502 are stored in the memory 501, and are configured to be executed by one or more processors 503 to perform the following operations according to the one or more instructions 502:
when a page rendering request sent by a browser is received, acquiring initial page structure data of a web page to be rendered, wherein the page structure data comprises target data items corresponding to each network data to be displayed by the web page;
determining a docking interface corresponding to each target data item, and acquiring a target primary key name corresponding to each target data item in the initial page structure;
reading preset configuration information in the docking interface, and sending a docking request to the docking interface based on each target primary key name and the configuration information, so that the docking interface returns a service data source corresponding to each target primary key name according to the docking request; the business data source comprises a plurality of data objects, and a bit occupying string and a mapping primary key value which are respectively corresponding to each data object;
determining placeholders corresponding to the target data items in the initial page structure data, calling a preset macro replacement engine according to the service data source and the initial page structure data, and replacing placeholder strings in the data objects with the placeholders to obtain final page structure data;
and inputting the final page structure data into a preset page rendering engine, obtaining a page code corresponding to the web page, sending the page code to the browser, and triggering the browser to render the web page according to the page code.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the system or system embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described system and system embodiments are only illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both.
To clearly illustrate this interchangeability of hardware and software, various illustrative components and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method of web page rendering, comprising:
when a page rendering request sent by a browser is received, acquiring initial page structure data of a web page to be rendered, wherein the page structure data comprises target data items corresponding to each network data to be displayed by the web page;
determining a docking interface corresponding to each target data item, and acquiring a target primary key name corresponding to each target data item in the initial page structure;
reading preset configuration information in the docking interface, and sending a docking request to the docking interface based on each target primary key name and the configuration information, so that the docking interface returns a service data source corresponding to each target primary key name according to the docking request; the business data source comprises a plurality of data objects, and each data object comprises a corresponding bit occupying string and a mapping primary key value;
determining placeholders corresponding to the target data items in the initial page structure data, calling a preset macro replacement engine according to the service data source and the initial page structure data, and replacing placeholder strings in the data objects with the placeholders to obtain final page structure data;
and inputting the final page structure data into a preset page rendering engine, obtaining a page code corresponding to the web page, sending the page code to the browser, and triggering the browser to render the web page according to the page code.
2. The method of claim 1, wherein the determining the docking interface corresponding to each target data item comprises:
acquiring interface state information corresponding to each target data item contained in the initial page structure data;
judging whether the interface state information contains an opening state identifier or not; the starting state identifier represents the corresponding target data item starting interface docking function;
and if the interface state information contains an opening state identifier, acquiring interface data contained in the interface state information, and determining a docking interface corresponding to each target data item according to the interface data.
3. The method of claim 1, wherein sending a docking request to the docking interface based on each of the target primary key name and the configuration information comprises:
generating a primary key name set parameter containing each target primary key name according to each target primary key name, and acquiring an interface UR L address corresponding to the docking interface contained in the configuration information;
and sending a docking request carrying the primary key name set parameters to the docking interface based on the UR L address.
4. The method according to claim 1, wherein the step of calling a preset macro replacement engine according to the service data source and the initial page structure data to replace the placeholder strings in the data objects with the placeholders comprises:
acquiring a mapping primary key value and a holding character string corresponding to each data object in the service data source;
matching each mapping primary key value with a target primary key name of each target data item, and establishing a one-to-one correspondence relationship between each mapping primary key value and each target primary key name;
and calling a preset macro replacement engine, and replacing each placeholder string and each placeholder based on the one-to-one correspondence between each mapping primary key value and each target primary key name.
5. The method of claim 1, after obtaining the page code corresponding to the web page, further comprising:
and generating an HTM L document from the page code, and sending the HTM L document to the browser, so that the browser loads the HTM L document and renders the web page according to preset page rendering rules.
6. A web page rendering apparatus, comprising:
the system comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring initial page structure data of a web page to be rendered when a page rendering request sent by a browser is received, and the page structure data comprises target data items corresponding to each network data to be displayed of the web page;
a determining unit, configured to determine a docking interface corresponding to each target data item, and obtain a target primary key name corresponding to each target data item in the initial page structure;
a sending unit, configured to read configuration information preset in the docking interface, and send a docking request to the docking interface based on each target primary key name and the configuration information, so that the docking interface returns a service data source corresponding to each target primary key name according to the docking request; the business data source comprises a plurality of data objects, and each data object comprises a corresponding bit occupying string and a mapping primary key value;
a replacing unit, configured to determine placeholders corresponding to the target data items in the initial page structure data, and according to the service data source and the initial page structure data, invoke a preset macro replacing engine to replace placeholder strings in the data objects with the placeholders, so as to obtain final page structure data;
and the rendering unit is used for inputting the final page structure data into a preset page rendering engine, acquiring a page code corresponding to the web page, sending the page code to the browser, and triggering the browser to render the web page according to the page code.
7. The apparatus of claim 6, wherein the determining unit comprises:
the first obtaining subunit is configured to obtain interface state information corresponding to each target data item included in the initial page structure data;
a judging subunit, configured to judge whether the interface state information includes an open state identifier; the starting state identifier represents the corresponding target data item starting interface docking function;
and the determining subunit is configured to, if the interface state information includes an open state identifier, acquire interface data included in the interface state information, and determine, according to the interface data, a docking interface corresponding to each target data item.
8. The apparatus of claim 6, wherein the sending unit comprises:
a generating subunit, configured to generate, according to each target primary key name, a primary key name set parameter including each target primary key name, and acquire an interface UR L address corresponding to the docking interface included in the configuration information;
a sending subunit, configured to send, to the docking interface, a docking request carrying the parameter of the primary key name set based on the UR L address.
9. The apparatus of claim 6, wherein the replacement unit comprises:
a second obtaining subunit, configured to obtain a mapping primary key value and a placeholder string corresponding to each data object in the service data source;
the matching subunit is configured to match each mapping primary key value with a target primary key name of each target data item, and establish a one-to-one correspondence between each mapping primary key value and each target primary key name;
and the replacing subunit is used for calling a preset macro replacing engine and replacing each placeholder string and each placeholder based on the one-to-one correspondence relationship between each mapping primary key value and each target primary key name.
10. The apparatus of claim 6, further comprising:
and the generating unit is used for generating an HTM L document from the page code and sending the HTM L document to the browser, so that the browser loads the HTM L document and renders the web page according to preset page rendering rules.
CN202010201225.9A 2020-03-20 2020-03-20 Web page rendering method and device Active CN111428170B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010201225.9A CN111428170B (en) 2020-03-20 2020-03-20 Web page rendering method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010201225.9A CN111428170B (en) 2020-03-20 2020-03-20 Web page rendering method and device

Publications (2)

Publication Number Publication Date
CN111428170A true CN111428170A (en) 2020-07-17
CN111428170B CN111428170B (en) 2023-04-21

Family

ID=71549695

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010201225.9A Active CN111428170B (en) 2020-03-20 2020-03-20 Web page rendering method and device

Country Status (1)

Country Link
CN (1) CN111428170B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113051503A (en) * 2021-03-12 2021-06-29 平安银行股份有限公司 Browser page rendering method and device, electronic equipment and storage medium
CN116009863A (en) * 2022-12-30 2023-04-25 中电金信软件有限公司 Front-end page rendering method, device and storage medium
WO2023082994A1 (en) * 2021-11-15 2023-05-19 华人运通(上海)云计算科技有限公司 Page rendering method and apparatus, and terminal device and computer storage medium
CN116894133A (en) * 2023-08-28 2023-10-17 深圳有咖互动科技有限公司 Project service page display method, device, equipment and computer readable medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100005053A1 (en) * 2008-07-04 2010-01-07 Estes Philip F Method for enabling discrete back/forward actions within a dynamic web application
CN107241372A (en) * 2016-03-29 2017-10-10 阿里巴巴集团控股有限公司 Configuration information generation, sending method and resource loading method and apparatus and system
CN108427597A (en) * 2018-03-16 2018-08-21 崔红保 Accelerate the method and device of page rendering
CN110647699A (en) * 2019-08-13 2020-01-03 平安普惠企业管理有限公司 Web page rendering method and device, computer equipment and storage medium
CN110807161A (en) * 2019-11-08 2020-02-18 深圳乐信软件技术有限公司 Page framework rendering method, device, equipment and medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100005053A1 (en) * 2008-07-04 2010-01-07 Estes Philip F Method for enabling discrete back/forward actions within a dynamic web application
CN107241372A (en) * 2016-03-29 2017-10-10 阿里巴巴集团控股有限公司 Configuration information generation, sending method and resource loading method and apparatus and system
CN108427597A (en) * 2018-03-16 2018-08-21 崔红保 Accelerate the method and device of page rendering
CN110647699A (en) * 2019-08-13 2020-01-03 平安普惠企业管理有限公司 Web page rendering method and device, computer equipment and storage medium
CN110807161A (en) * 2019-11-08 2020-02-18 深圳乐信软件技术有限公司 Page framework rendering method, device, equipment and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
袁剑;刘刚;王文海;: "基于Web的个性化教学模型的研究" *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113051503A (en) * 2021-03-12 2021-06-29 平安银行股份有限公司 Browser page rendering method and device, electronic equipment and storage medium
WO2023082994A1 (en) * 2021-11-15 2023-05-19 华人运通(上海)云计算科技有限公司 Page rendering method and apparatus, and terminal device and computer storage medium
CN116009863A (en) * 2022-12-30 2023-04-25 中电金信软件有限公司 Front-end page rendering method, device and storage medium
CN116009863B (en) * 2022-12-30 2024-01-19 中电金信软件有限公司 Front-end page rendering method, device and storage medium
CN116894133A (en) * 2023-08-28 2023-10-17 深圳有咖互动科技有限公司 Project service page display method, device, equipment and computer readable medium
CN116894133B (en) * 2023-08-28 2023-11-24 深圳有咖互动科技有限公司 Project service page display method, device, equipment and computer readable medium

Also Published As

Publication number Publication date
CN111428170B (en) 2023-04-21

Similar Documents

Publication Publication Date Title
CN111428170B (en) Web page rendering method and device
CN100444158C (en) Web page rendering mechanism using external programmatic themes
JP4340566B2 (en) Web page generation apparatus, embedded apparatus, Web page generation control method, Web page generation program, and recording medium
EP1641211A2 (en) Web server and method for dynamic content.
CN111563220A (en) Business website project construction method and device, computer equipment and storage medium
US20200387372A1 (en) Microservice file generation system
CN108717437B (en) Search result display method and device and storage medium
CN101183355A (en) Program, copy and paste processing method, apparatus, and storage medium
AU2008332701A1 (en) Templating system and method for updating content in real time
CN106533926B (en) Webpage information spreading method and device
CN111324833A (en) Page display method, device, electronic design and computer readable medium
WO2014045826A1 (en) Web server system, dictionary system, dictionary call method, screen control display method, and demonstration application generation method
CN112925513A (en) Web page construction method and device
CN114020846A (en) Processing method and device capable of changing NFT (network File transfer) works
Lachgar et al. Modeling and generating native code for cross-platform mobile applications using DSL
US10949176B2 (en) Automatic view generation based on annotations
CN112905944A (en) Page online dynamic generation method and device, electronic equipment and readable storage medium
CN112114805A (en) Page generation method, device and equipment
CN111680247A (en) Local calling method, device, equipment and storage medium of webpage character string
CN115481288A (en) Method and device for realizing conversion from online interface document to offline interface document
CN113961279A (en) Page rendering method, device, server and storage medium
Rachovski et al. Models and methodologies for automated creating of webpage mobile versions
JP2020119409A (en) Program, information processing apparatus, and processing method
KR102560619B1 (en) Electronic device providing no-code tool service and method thereof
CN113741900B (en) Development method and device of front-end page application and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant