CN111428170B - Web page rendering method and device - Google Patents

Web page rendering method and device Download PDF

Info

Publication number
CN111428170B
CN111428170B CN202010201225.9A CN202010201225A CN111428170B CN 111428170 B CN111428170 B CN 111428170B CN 202010201225 A CN202010201225 A CN 202010201225A CN 111428170 B CN111428170 B CN 111428170B
Authority
CN
China
Prior art keywords
data
page
interface
target
docking
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.)
Active
Application number
CN202010201225.9A
Other languages
Chinese (zh)
Other versions
CN111428170A (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 Happly Sunshine Interactive Entertainment Media Co Ltd
Original Assignee
Hunan Happly Sunshine 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 Happly Sunshine Interactive Entertainment Media Co Ltd filed Critical Hunan Happly Sunshine 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

Abstract

The invention relates to the technical field of computers, and particularly provides a web page rendering method and device. And acquiring the occupying character strings in each data object contained in the service data source, replacing each occupying character corresponding to each data item with each occupying character string through a macro replacement engine to obtain modified final page structure data, and rendering the web page through the final page structure data. The placeholders of the data items are replaced by the method, so that the network data corresponding to the data items displayed on the web page after rendering is edited network data, and personalized customization of the web page during rendering is realized.

Description

Web page rendering method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for rendering a web page.
Background
With the development of computer technology, people can access various network data such as files, pictures, texts, etc. in the internet through application programs such as a browser on various terminal devices. When a user requests to access the network data on the browser, rendering a web page corresponding to the network data through a page code corresponding to the page structure data, and displaying the accessed network data to the user through the web page.
The page structure data of the web page comprises static information and dynamic information, wherein the static information is code information in a fixed page code, and the dynamic information is network data information obtained through an interface corresponding to the network data. When a web page needs to be rendered, a user can change the page frame of the web page by editing the static information. However, in the prior art, dynamic information in the web page cannot be edited, and personalized customization during rendering of the web page is limited.
Disclosure of Invention
In view of the above, the present invention provides a web page rendering method, by which personalized customization of web pages can be achieved when web page rendering is required.
The invention also provides a web page rendering device which is used for guaranteeing 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 various network data to be displayed of the web page;
determining a butt joint 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 service data sources corresponding to each target primary key name according to the docking request; the service data source comprises a plurality of data objects, and each data object comprises a corresponding occupying character string and a mapping primary key value;
determining placeholders corresponding to the target data items in the initial page structure data, and calling a preset macro substitution engine to substitute the placeholders and the placeholders in the data objects according to the service data source and the initial page structure data to obtain final page structure data;
inputting the final page structure data into a preset page rendering engine, obtaining a page code corresponding to the web page, and sending the page code to the browser, and triggering the browser to render the web page according to the page code.
The above method, 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 opening state identifier indicates the corresponding opening interface docking function of each target data item;
and if the interface state information comprises an opening state identifier, acquiring interface data contained in the interface state information, and determining a butt joint interface corresponding to each target data item according to the interface data.
In the above method, optionally, the 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 URL address corresponding to the docking interface contained in the configuration information;
and sending a docking request carrying the primary key name set parameter to the docking interface based on the URL address.
According to the above method, optionally, according to the service data source and the initial page structure data, a preset macro substitution engine is called to replace the placeholder character strings in the data objects with the placeholders, including:
Obtaining a mapping primary key value and a occupation character string corresponding to each data object in the service data source;
matching each mapping main key value with a target main key name of each target data item, and establishing a one-to-one correspondence between each mapping main key value and each target main key name;
and calling a preset macro substitution engine, and substituting each placeholder character string with each placeholder character based on a one-to-one correspondence between each mapping main key value and each target main key name.
The method, optionally, further includes, after obtaining the page code corresponding to the web page:
and generating the HTML document by the page code, and sending the HTML document to the browser, so that the browser loads the HTML document and renders the web page according to preset page rendering rules.
A web page rendering apparatus comprising:
the method comprises the steps that an 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, wherein the page structure data comprises target data items corresponding to various network data to be displayed of the web page;
The determining unit is used for determining a butt joint 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;
the sending unit is used for reading preset configuration information in the docking interface, and sending a docking request to the docking interface based on each target main key name and the configuration information, so that the docking interface returns a service data source corresponding to each target main key name according to the docking request; the service data source comprises a plurality of data objects, and each data object comprises a corresponding occupying character string and a mapping primary key value;
the replacing unit is used for determining placeholders corresponding to the target data items in the initial page structure data, calling a preset macro replacing engine according to the service data source and the initial page structure data, and replacing the placeholders and the placeholders in the data objects to obtain final page structure data;
the rendering unit is used for 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 above apparatus, optionally, the determining unit includes:
the first acquisition subunit is used for acquiring interface state information corresponding to each target data item contained in the initial page structure data;
a judging subunit, configured to judge whether the interface status information includes an on-state identifier; the opening state identifier indicates the corresponding opening interface docking function of each target data item;
and the determining subunit is used for acquiring the interface data contained in the interface state information if the interface state information contains the starting state identifier, and determining the butt joint interfaces corresponding to the target data items according to the interface data.
The above apparatus, optionally, the sending unit includes:
the generation subunit is used for generating a primary key name set parameter containing each target primary key name according to each target primary key name, and acquiring an interface URL address corresponding to the docking interface contained in the configuration information;
and the sending subunit is used for sending a docking request carrying the primary key name set parameter to the docking interface based on the URL address.
The above device, optionally, the replacing unit includes:
The second obtaining subunit is used for obtaining the mapping primary key value and the occupying character string corresponding to each data object in the service data source;
the matching subunit is used for matching each mapping main key value with the target main key name of each target data item, and establishing a one-to-one correspondence between each mapping main key value and each target main key name;
and the replacing subunit is used for calling a preset macro replacing engine and replacing each placeholder character string with each placeholder character based on the one-to-one correspondence between each mapping main key value and each target main key name.
The above device, optionally, further comprises:
and the generating unit is used for generating the HTML document by the page code and sending the HTML document to the browser so that the browser loads the HTML document and renders the web page according to a preset page rendering rule.
A storage medium comprising stored instructions, wherein the instructions, when executed, control a device on which the storage medium resides 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 perform the above-described web page rendering method by one or more processors.
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 target primary key names 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 service data sources 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 substitution engine, and substituting the placeholder character strings in the data objects with the placeholders to obtain final page structure data; inputting the final page structure data into a preset page rendering engine, obtaining a page code corresponding to the web page, and sending the page code to the browser, and triggering the browser to render the web page according to the page code. When the method provided by the invention is applied, when the web page is required to be rendered, the business data source which is required to edit each data item in the web page is acquired by docking with the docking interface, the occupation character string in each data object in the business data source is acquired, and each occupation character of each data item is replaced, so that the aim of editing and replacing each data item is fulfilled, the network data displayed by the web page after rendering is the edited network data, and the personalized customization of the web page during rendering is realized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a method flow chart of a page rendering method according to an embodiment of the present invention;
FIG. 2 is a flowchart of another method of rendering a page 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 following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the 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 "comprise," "include," 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 one … …" does not exclude the presence of other like 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 devices, multiprocessor devices, distributed computing environments that include any of the above devices or devices, and the like.
The embodiment of the invention provides a web page rendering method, which can be applied to various system platforms, wherein an execution subject of the method can be a page construction tool arranged in a processor of a computer terminal or various mobile equipment, the page construction tool is used for constructing a web page, and a flow chart of the method is shown in fig. 1 and specifically comprises the following steps:
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 various network data to be displayed of the web page;
in an embodiment of the invention, the page structure data is a software data structure describing web page information and structure. The web page contains a plurality of network data, such as files, pictures, texts, etc., and in the page structure data, each network data exists in the form of data items. 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 the page rendering request is received, the page construction tool acquires initial page structure data of the web page.
It should be noted that the initial page structure data is page structure data of the web page before editing, and in the invention, the modification and editing of the network data in the web page are realized by changing the data item in the initial page structure data.
S102: determining a butt joint 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 a new web page, the new web page needs to be constructed through a page construction tool. When a web page is constructed by a page construction tool, a docking interface corresponding to each target data item needs to be determined.
The interface is a data interface for editing the web page by a user to provide related data, and the user sets related data and codes corresponding to the data items to be replaced, such as occupied character strings, mapped primary key names and the like, through the interface. The page building tool may implement the respective data items in the page structure data based on 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 service data sources corresponding to each target primary key name according to the docking request; the service data source comprises a plurality of data objects, and a space occupying character string and a mapping primary key value which correspond to each data object respectively;
In the embodiment of the invention, the configuration information is interface information which is set by a user on the management platform and is associated with the docking interface, wherein the interface information can comprise an interface URL address, an attribute name, a data type and the like. And sending a docking request to a docking interface through the configuration information and each target main key name, and after receiving the docking request, the docking interface acquires service data sources corresponding to each target main key name and returns the service data sources to a page construction tool of the web page. The placeholder character string is a data code symbol corresponding to network data which is finally required to be applied to an actual page code after being edited on the web page.
Specifically, the service data source includes a plurality of data objects, and each data object may correspond to each target primary key name one by one. When the user needs to edit and modify the web page, setting corresponding data objects to be replaced corresponding to the target data corresponding to the target main key name, wherein the data objects are stored with occupied character strings to be replaced, and the set formed by the data objects is a service data source.
S104: determining placeholders corresponding to the target data items in the initial page structure data, and calling a preset macro substitution engine to substitute the placeholders and the placeholders in the data objects according to the service data source and the initial page structure data to obtain final page structure data;
In the embodiment of the invention, in the page structure data, each target data item is provided with a corresponding placeholder, the placeholder is used for taking place at the position of the corresponding data item, and when new data needs to be replaced by the target data item or added to the target data item, a designated character can be replaced on the placeholder.
The characters in the placeholders corresponding to the target data items can be the placeholders without any data characters, or can be the previous placeholder character string for the user to edit 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 symbol; and if one picture on the web page needs to be replaced with a new picture, the placeholder of the data item corresponding to the position of the original picture is the placeholder character string of the picture.
Specifically, the macro substitution engine is used for substituting the placeholder character strings in each data object into the corresponding placeholders thereof so as to realize the transformation of the page structure data and obtain the final page structure data.
S105: inputting the final page structure data into a preset page rendering engine, obtaining a page code corresponding to the web page, and sending the page code to the browser, and triggering the browser to render the web page according to the page code.
In the present example, the page rendering engine is a transcoding tool that transcodes structural data that needs to be converted into page code when obtaining final page structural data. By running the page code, the browser can display the web page to the user, 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 the user needs to edit and modify the content in the web page, the configuration information of the web page needing to be edited and modified is configured in advance on the management platform, and meanwhile, when the interface is connected with the web page, the interface is created by the interface, and the web page is connected with the service data sources related to each content needing to be edited and modified. When the browser sends a page rendering request, initial page structure data of a web page to be rendered is obtained, and a docking interface corresponding to each target data item is determined. And docking with a docking interface through configuration information and target primary key names of all target data items to obtain a service data source, and replacing placeholders in the initial page structure data with corresponding placeholder character strings in all data objects in the service data source through a macro replacement engine to edit the web page so as to obtain final page structure data. And converting the final page structure data into page codes through a page rendering engine, and rendering the web pages required by the user according to the page codes by a 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 renders the web page by running the converted codes.
When the method provided by the embodiment of the invention is applied, when the web page is required to be rendered, the service data source which is required to edit each data item in the web page is acquired by docking with the docking interface, the occupation character string in each data object in the service data source is acquired, and each occupation character of each data item is replaced, so that the aim of editing and replacing each data item is fulfilled, the network data displayed by the web page after rendering is edited network data, and personalized customization of the web page during rendering is realized.
Specifically, based on the method provided in the above embodiment, after obtaining the final page structure data, the final page structure data needs to be input into a preset page rendering engine to obtain the page code of the web page to be rendered. Before the page code is sent to the browser for web page rendering, the method specifically further comprises the following steps:
and generating the HTML document by the page code, and sending the HTML document to the browser, so that the browser loads the HTML 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 a cascading style sheet CSS rule. When the browser needs to render a web page, hypertext markup language HTML code needs to be displayed in the browser window according to the rules defined by CSS. Therefore, after obtaining the page code, an HTML document needs to be generated, and the code in the HTML document is the HTML code, so that the browser can render the web page according to the rule defined by the CSS after receiving the HTML document.
The process of generating the HTML document may also be generated by the page rendering engine.
In the method provided by the embodiment of the present invention, based on the content of step S102, the initial page structure data includes a plurality of data items, each data item may correspond to the same docking interface, and docking interfaces corresponding to different data items may also be different. Specifically, the process of determining the docking interface corresponding to each target data item is shown in fig. 2, and 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 invention, the interface state information comprises 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 opening state identifier indicates the corresponding opening interface docking function of each target data item;
in the embodiment of the invention, in the interface state information, if the interface state information contains the open state identifier, network data in the web page to be rendered currently is characterized to be modified, and the interface corresponding to each target data item is required to be docked. And starting the interface docking function for each target data item, so as to change the identifier of the current state in the interface state information into an on-state identifier.
Optionally, the identifier of the current state is a closed state identifier if no modification of the network data in the web page is required.
S203: and if the interface state information comprises an opening state identifier, acquiring interface data contained in the interface state information, and determining a butt joint interface corresponding to each target data item according to the interface data.
In the embodiment of the invention, if the interface state information contains the open state identifier, the network data in the web page to be rendered currently is characterized to be modified, and the docking interfaces corresponding to the target data items are required to be docked. And determining a docking interface which needs 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 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 an open state identifier, the interface is required to be docked, and each target data item is modified, so that the modification of each network data in the web page is realized.
When the interface state information contains the open state identifier, the method provided by the embodiment of the invention can determine the docking interface needing docking 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 is achieved when the web page is rendered.
In the method provided by the embodiment of the present invention, based on the content of the 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 URL address corresponding to the docking interface contained in the configuration information;
And sending a docking request carrying the primary key name set parameter to the docking interface based on the URL address.
In the web page rendering method provided by the embodiment of the 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 the target data item, the representation form of the picture name corresponding to the picture in the initial page structure data is the target primary key name, and the target primary key name can be the name or the characteristic of the id, name and the like of the target data item for carrying out visual representation on the target data item. Generating a primary key name set by each target primary key name, taking an interface URL address corresponding to the docking interface contained in the configuration information as a request address, taking the primary key name set as a parameter, and sending a docking request to the docking interface.
The docking request includes a primary key name set parameter, that is, includes each target primary key name. And generating a corresponding HTTP request by the main key name set parameter and the interface URL address, and sending the HTTP request to the butt joint interface. After receiving the HTTP request, the docking interface analyzes the HTTP request to obtain each target main key name, searches the data object corresponding to each target main key name according to each target main key name, and generates a service data source for feedback.
By applying the method of the embodiment of the invention, the main key name set parameters and the interface URL address generated by each target main key name are used for sending a docking request to the docking interface to send a docking request so as to obtain a service data source returned by the docking interface, thereby realizing personalized customization of the web page.
In the method provided by the embodiment of the present invention, based on the content of the step S104, the process of replacing the placeholder strings and the placeholders in the data objects according to the service data source and the initial page structure data and calling a macro replacement engine set in advance is shown in fig. 3, and may specifically include:
s301: obtaining a mapping primary key value and a occupation 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 corresponding occupying character string of the mapping primary key value.
The expression form of each mapping primary key value is consistent with the expression form of each target primary key name, and each mapping primary key value represents a name or a characteristic for visually representing a data item, such as an id, a name, a characteristic identifier and the like of a certain data item. The placeholder string is a code string of the data item that needs to be changed.
For example, in the initial page structure data, the target primary key name is name1=a, and if modification is required to the initial page structure data, in the service data source, the mapped primary key value corresponding to the target primary key name is name1=a.
S302: matching each mapping main key value with a target main key name of each target data item, and establishing a one-to-one correspondence between each mapping main key value and each target main 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 is established between the name 1=a and the target primary key name 1=a.
S303: and calling a preset macro substitution engine, and substituting each placeholder character string with each placeholder character based on a one-to-one correspondence between each mapping main key value and each target main key name.
In the embodiment of the invention, each data object corresponds to a mapping primary key value and a placeholder character string, and each target data item corresponds to a target primary key name and a placeholder. Through the one-to-one correspondence established between each mapping primary key value and each target primary key name, the one-to-one correspondence between each data item and each data object can be determined, and the one-to-one correspondence between each placeholder character string and each placeholder symbol can be determined. And replacing each placeholder character string and each placeholder character by the macro replacement engine according to the one-to-one correspondence between each placeholder character string and each placeholder character.
According to the web page rendering method provided by the embodiment of the invention, the one-to-one correspondence between the target main key names and the target main key values in the data objects is determined, and each placeholder character string and each placeholder are replaced through the correspondence between each mapping main key value and each target main key name, so that the page structure data corresponding to the web page is modified, and the purpose of modifying the web page is achieved.
Specifically, after replacing each placeholder character string with each placeholder character, the macro replacement engine changes the initial page structure data to obtain final page structure data for feedback.
By applying the method provided by the embodiment of the invention, each placeholder character string and each placeholder character are replaced through the macro replacement engine, modification before rendering of the web page to be rendered is completed, and personalized customization of the web page is realized.
The specific implementation process and derivative manner of the above embodiments are all within the protection scope of the present invention.
Corresponding to the method described in fig. 1, the embodiment of the present invention further provides a web page rendering device, which is used for implementing the method in fig. 1, where the web page rendering device provided in the embodiment of the present invention may be applied to a computer terminal or various mobile devices, and the schematic structural diagram of the web page rendering device is shown in fig. 4, and specifically includes:
An obtaining unit 401, configured to obtain, when a page rendering request sent by a browser is received, initial page structure data of a web page to be rendered, where the page structure data includes target data items corresponding to respective network data to be displayed by 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 service data source comprises a plurality of data objects, and a space occupying character string and a mapping primary key value which correspond to each data object respectively;
a replacing unit 404, configured to determine placeholders corresponding to the target data items in the initial page structure data, and call a macro replacing engine set in advance according to the service data source and the initial page structure data, so as to replace the placeholder strings in the data objects with the placeholders, thereby obtaining final page structure data;
And the rendering unit 405 is 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 device provided by the embodiment of the invention, when a page rendering request is received, the acquisition unit acquires initial page structure data, and the determination unit determines the docking interfaces corresponding to all target data items in the initial page structure data. And sending a docking request to the docking interface by the sending unit through the main key names of all targets and the configuration information of the docking interface so as to obtain a service data source. And acquiring each occupying character string from the service data source, replacing the occupying character string with the occupying character corresponding to each target data item by the replacing unit through calling the macro replacing engine, so as to realize the purpose of modifying the web page, finally obtaining final page structure data, inputting the final page structure data into the page rendering engine by the rendering unit, obtaining the page code of the web page, and rendering the web page according to the page code by the browser.
By applying the device provided by the embodiment of the invention, the butt joint is realized with the butt joint interface through the sending unit 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 by the embodiment of the present invention, the determining unit 402 includes:
the first acquisition subunit is used for acquiring interface state information corresponding to each target data item contained in the initial page structure data;
a judging subunit, configured to judge whether the interface status information includes an on-state identifier; the opening state identifier indicates the corresponding opening interface docking function of each target data item;
and the determining subunit is used for acquiring the interface data contained in the interface state information if the interface state information contains the starting state identifier, and determining the butt joint interfaces corresponding to the target data items according to the interface data.
In the apparatus provided by the embodiment of the present invention, the sending unit 403 includes:
the generation subunit is used for generating a primary key name set parameter containing each target primary key name according to each target primary key name, and acquiring an interface URL address corresponding to the docking interface contained in the configuration information;
And the sending subunit is used for sending a docking request carrying the primary key name set parameter to the docking interface based on the URL address.
In the apparatus provided by the embodiment of the present invention, the replacing unit 404 includes:
the second obtaining subunit is used for obtaining the mapping primary key value and the occupying character string corresponding to each data object in the service data source;
the matching subunit is used for matching each mapping main key value with the target main key name of each target data item, and establishing a one-to-one correspondence between each mapping main key value and each target main key name;
and the replacing subunit is used for calling a preset macro replacing engine and replacing each placeholder character string with each placeholder character based on the one-to-one correspondence between each mapping main key value and each target main key name.
The device provided by the embodiment of the invention further comprises:
and the generating unit is used for generating the HTML document by the page code and sending the HTML document to the browser so that the browser loads the HTML document and renders the web page according to a preset page rendering rule.
The specific working process of each unit and sub-unit in the web page rendering device disclosed in the above embodiment of the present invention can refer to the corresponding content in the web page rendering method disclosed in the above embodiment of the present invention, and will not be described herein again.
The embodiment of the invention also provides a storage medium, which comprises stored instructions, wherein the equipment where the storage medium is located is controlled to execute the web page rendering method when the instructions run.
The embodiment of the present invention further provides an electronic device, whose structural schematic diagram is shown in fig. 5, specifically including a memory 501, and one or more instructions 502, where the one or more instructions 502 are stored in the memory 501, and configured to be executed by the one or more processors 503, where the one or more instructions 502 perform the following operations:
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 various network data to be displayed of the web page;
determining a butt joint 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 service data sources corresponding to each target primary key name according to the docking request; the service data source comprises a plurality of data objects, and a space occupying character string and a mapping primary key value which correspond to each data object respectively;
determining placeholders corresponding to the target data items in the initial page structure data, and calling a preset macro substitution engine to substitute the placeholders and the placeholders in the data objects according to the service data source and the initial page structure data to obtain final page structure data;
inputting the final page structure data into a preset page rendering engine, obtaining a page code corresponding to the web page, and sending the page code to the browser, and triggering the browser to render the web page according to the page code.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for a system or system embodiment, since it is substantially similar to a method embodiment, the description is relatively simple, with reference to the description of the method embodiment being made in part. The systems and system embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
Those of skill would further appreciate that the elements and algorithm steps of the examples 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 solution. 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 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 various network data to be displayed of the web page;
determining a butt joint 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 service data sources corresponding to each target primary key name according to the docking request; the service data source comprises a plurality of data objects, and each data object comprises a corresponding occupying character string and a mapping primary key value;
determining placeholders corresponding to the target data items in the initial page structure data, and calling a preset macro substitution engine to substitute the placeholders and the placeholders in the data objects according to the service data source and the initial page structure data to obtain final page structure data;
Inputting the final page structure data into a preset page rendering engine, obtaining a page code corresponding to the web page, and 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 said determining a docking interface for each of said target data items 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 opening state identifier indicates the corresponding opening interface docking function of each target data item;
and if the interface state information comprises an opening state identifier, acquiring interface data contained in the interface state information, and determining a butt joint interface corresponding to each target data item according to the interface data.
3. The method of claim 1, wherein the 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 URL address corresponding to the docking interface contained in the configuration information;
And sending a docking request carrying the primary key name set parameter to the docking interface based on the URL address.
4. The method of claim 1, wherein said replacing the placeholder strings in each of the data objects with each of the placeholders according to the service data source and the initial page structure data and by invoking a pre-set macro replacement engine comprises:
obtaining a mapping primary key value and a occupation character string corresponding to each data object in the service data source;
matching each mapping main key value with a target main key name of each target data item, and establishing a one-to-one correspondence between each mapping main key value and each target main key name;
and calling a preset macro substitution engine, and substituting each placeholder character string with each placeholder character based on a one-to-one correspondence between each mapping main key value and each target main key name.
5. The method according to claim 1, further comprising, after obtaining the page code corresponding to the web page:
and generating the HTML document by the page code, and sending the HTML document to the browser, so that the browser loads the HTML document and renders the web page according to preset page rendering rules.
6. A web page rendering apparatus, comprising:
the method comprises the steps that an 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, wherein the page structure data comprises target data items corresponding to various network data to be displayed of the web page;
the determining unit is used for determining a butt joint 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;
the sending unit is used for reading preset configuration information in the docking interface, and sending a docking request to the docking interface based on each target main key name and the configuration information, so that the docking interface returns a service data source corresponding to each target main key name according to the docking request; the service data source comprises a plurality of data objects, and each data object comprises a corresponding occupying character string and a mapping primary key value;
the replacing unit is used for determining placeholders corresponding to the target data items in the initial page structure data, calling a preset macro replacing engine according to the service data source and the initial page structure data, and replacing the placeholders and the placeholders in the data objects to obtain final page structure data;
The rendering unit is used for 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.
7. The apparatus according to claim 6, wherein the determining unit includes:
the first acquisition subunit is used for acquiring interface state information corresponding to each target data item contained in the initial page structure data;
a judging subunit, configured to judge whether the interface status information includes an on-state identifier; the opening state identifier indicates the corresponding opening interface docking function of each target data item;
and the determining subunit is used for acquiring the interface data contained in the interface state information if the interface state information contains the starting state identifier, and determining the butt joint interfaces corresponding to the target data items according to the interface data.
8. The apparatus of claim 6, wherein the transmitting unit comprises:
the generation subunit is used for generating a primary key name set parameter containing each target primary key name according to each target primary key name, and acquiring an interface URL address corresponding to the docking interface contained in the configuration information;
And the sending subunit is used for sending a docking request carrying the primary key name set parameter to the docking interface based on the URL address.
9. The apparatus of claim 6, wherein the replacement unit comprises:
the second obtaining subunit is used for obtaining the mapping primary key value and the occupying character string corresponding to each data object in the service data source;
the matching subunit is used for matching each mapping main key value with the target main key name of each target data item, and establishing a one-to-one correspondence between each mapping main key value and each target main key name;
and the replacing subunit is used for calling a preset macro replacing engine and replacing each placeholder character string with each placeholder character based on the one-to-one correspondence between each mapping main key value and each target main key name.
10. The apparatus as recited in claim 6, further comprising:
and the generating unit is used for generating the HTML document by the page code and sending the HTML document to the browser so that the browser loads the HTML document and renders the web page according to a preset page rendering rule.
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 CN111428170A (en) 2020-07-17
CN111428170B true 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)

Families Citing this family (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
CN116127223A (en) * 2021-11-15 2023-05-16 华人运通(上海)云计算科技有限公司 Page rendering method and device, terminal equipment and computer storage medium
CN116009863B (en) * 2022-12-30 2024-01-19 中电金信软件有限公司 Front-end page rendering method, device and storage medium
CN116894133B (en) * 2023-08-28 2023-11-24 深圳有咖互动科技有限公司 Project service page display method, device, equipment and computer readable medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* 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

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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的个性化教学模型的研究.青岛科技大学学报(自然科学版).2007,(01),全文. *

Also Published As

Publication number Publication date
CN111428170A (en) 2020-07-17

Similar Documents

Publication Publication Date Title
CN111428170B (en) Web page rendering method and device
JP4340566B2 (en) Web page generation apparatus, embedded apparatus, Web page generation control method, Web page generation program, and recording medium
CN100444158C (en) Web page rendering mechanism using external programmatic themes
Abrams et al. UIML: an appliance-independent XML user interface language
CN100430940C (en) Method and system for programming portal application
US7286145B2 (en) System for describing markup language for mobile use, and information processing apparatus and program for generating display content
US20110078593A1 (en) Web browser transmission server and method of controlling operation of same
CN106533926B (en) Webpage information spreading method and device
WO2014045826A1 (en) Web server system, dictionary system, dictionary call method, screen control display method, and demonstration application generation method
CN111177613A (en) Page processing method, device, equipment and storage medium
CN114020846A (en) Processing method and device capable of changing NFT (network File transfer) works
CN101876998B (en) Method and system for editing data
US20100169457A1 (en) Social user script service by service proxy
JP6002302B2 (en) Web application generation system, Web application generation system control method, Web application generation system program, Web application generation device, Web application generation device control method, and Web application generation device program
CN112905944A (en) Page online dynamic generation method and device, electronic equipment and readable storage medium
JP2004110427A (en) Web contents conversion method and system
JP7014960B2 (en) Information processing equipment, servers, their processing methods and programs
EP2557505A1 (en) Web display program conversion system, web display program conversion method, and program for web display program conversion
RU2634221C2 (en) Method and device for drawing presentation of electronic document on screen
CN114756790A (en) PC webpage content adaptation method facing mobile terminal
US10949176B2 (en) Automatic view generation based on annotations
Marin Practical mobile web design
KR102261153B1 (en) Method for creating application
KR102560619B1 (en) Electronic device providing no-code tool service and method thereof
US8291311B2 (en) Web display program conversion system, web display program conversion method and program for converting web display program

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