Disclosure of Invention
The application provides a page generation method, a device, equipment and a storage medium, which can improve the efficiency of page development.
The application provides a page generation method, which comprises the steps of receiving a page drawing request from a terminal, wherein the page drawing request is used for requesting front-end page information of a target page, reading the front-end page information corresponding to the page drawing request in the stored page information, sending the front-end page information to the terminal for the terminal to draw the target page, receiving a page data request from the terminal, wherein the page data request is used for requesting back-end page information of the target page, reading the back-end page information corresponding to the page data request in the page information, and sending the back-end page information to the terminal for the terminal to generate the target page.
Optionally, the front-end page information is in a non-hypertext markup language format, and the method comprises the steps of adjusting the format of the front-end page information to a hypertext markup language format to obtain hypertext markup language data, and sending the hypertext markup language data to the terminal.
Optionally, before receiving the page drawing request from the terminal, the method further comprises the steps of analyzing a configuration file to obtain cache data when the terminal is started, wherein the configuration file comprises page information, and loading the cache data into a cache.
Optionally, analyzing the configuration file to obtain the cache data includes analyzing page information in the configuration file to be a JAVA object to obtain the cache data.
Optionally, before the configuration file is parsed to obtain the cache data during starting, the method further comprises the steps of obtaining and storing the configuration file, wherein the configuration file is of a query list type and/or a paging list type, the configuration file of the query list type is used for generating a target page of the list page type, and the configuration file of the paging list type is used for generating a target page of the list page type.
The second aspect of the application provides a page generation method, which comprises the steps of receiving a page generation request from a terminal, wherein the page generation request is used for requesting to generate a target page, reading front-end page information and back-end page information corresponding to the page generation request in stored page information, and sending the front-end page information and the back-end page information to the terminal so as to enable the terminal to generate the target page.
In a third aspect, the present application provides a page generating apparatus, including:
the receiving module is used for receiving a page drawing request from the terminal, wherein the page drawing request is used for requesting a front-end page information surface of a target page, and receiving a page data request from the terminal, and the page data request is used for requesting back-end page information of the target page;
The reading module is used for reading front-end page information corresponding to the page drawing request from the stored page information and reading back-end page information corresponding to the page data request from the page information;
the terminal comprises a sending module, a target page generation module and a target page generation module, wherein the sending module is used for sending front-end page information to the terminal so as to enable the terminal to draw the target page, and sending back-end page information to the terminal so as to enable the terminal to generate the target page.
In a fourth aspect, the present application provides a page generating apparatus, including:
the receiving module is used for receiving a page generation request from the terminal, wherein the page generation request is used for requesting to generate a target page;
the reading module is used for reading front-end page information and back-end page information corresponding to the page generation request from the stored page information;
and the sending module is used for sending the front-end page information and the back-end page information to the terminal so as to enable the terminal to generate the target page.
In a fifth aspect, the present application provides an electronic device comprising a memory, a processor;
A memory for storing executable instructions;
A processor configured to execute executable instructions to implement the page generation method of the first or second aspect.
In a sixth aspect, the present application provides a computer-readable storage medium having stored therein computer-executable instructions for implementing the page generation method of the first or second aspect when executed by a processor.
In a seventh aspect, the present application provides a computer program product comprising a computer program which when executed implements the page generation method of the first or second aspect.
The page generation method, the device, the equipment and the storage medium provided by the application have the advantages that the page information is stored in the server, the page information comprises front-end page information and back-end page information, the back-end page information comprises the corresponding relation between the front-end page information and the back-end page information, therefore, when a target page based on a B/S mode is generated, a user interacts with the terminal to enable the terminal (or called a client) to send a page drawing request to the server, the server responds to the page drawing request, the front-end page information corresponding to the page drawing request is read from the stored page information to obtain the front-end page information, the server responds to the page data request, the back-end page information corresponding to the page data request is read from the stored page information to obtain the back-end page information, and then the target page is generated based on the obtained front-end page information and the back-end page information. The application can automatically render the front-end page with uniform structure and style without repeated development of the front-end page, and in addition, the development of background logic codes and database interaction codes for each function in the page is not needed, thereby saving labor cost and improving the development efficiency of the page.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
The B/S (Browser/Server) mode is a network structure mode, and the mode concentrates the core part of system function realization on the Server, thereby simplifying the development, maintenance and use of the system. Only one browser, such as Chrome, safari, microsoft Edge, netscape Navigator or Internet Explorer, is installed on the terminal, and a database, such as SQL SERVER, oracle or MYSQL, is installed on the server. The browser performs data interaction with the database through the server.
FIG. 1 is a schematic diagram of browser-server interaction in B/S mode. As shown in fig. 1, when a user accesses a database, after submitting an operation of accessing the database on the browser 11 of the terminal, the browser 11 sends a request, typically an http request, to the server 12, and correspondingly, the server 12 receives the request and responds to the request to obtain data corresponding to the request and sends the data to the browser 11. Server technology such as JSP (Java SERVER PAGES ) or the like may be used when the server 12 processes the request. The database stores data requested by the user, such as web page files, pictures, sounds, etc. When data transmitted to the browser is generally in HTML (hypertext markup language) format, the browser finally displays the data by interpreting and executing the HTML file.
The development of the page in the B/S mode is generally divided into the development of the front-end page, i.e. the page seen by the user when in use, and the development of the background logic for monitoring the change of the front-end page and responding to the operation on the front-end page. When the pages are developed in a traditional mode, each page needs to be drawn independently, and after drawing is completed, each page needs to be matched with the configuration of background logic. Such tedious and inefficient development work can be a significant waste of labor costs.
Thus, in the related art, tools have emerged to assist developers in completing front-end page production, such as page designers in intelligent development platforms as shown in FIG. 2. The developer designs the content needed by the target page in the page designer through controls such as 'new addition', 'save', 'list selection', 'column diagram', and the like, the 'parameter name', 'parameter value', 'parameter description' in fig. 2 appears as a header in the last formed page, and the lower data such as 'name_' helps to form the table content. By way of example, the page drawn through fig. 2 is shown in fig. 3. However, when using similar tools, specialized deployment of the tools is required and the deployment and maintenance costs are high. In addition, by using the method to develop the page, all background logic corresponding to the front-end page needs to be independently developed, so that the labor cost is high and the development efficiency is low. The generation efficiency of the front page is also limited by the tool used and the modified pages cannot be replicated in batches.
In order to solve the above problems, the present application provides a method, an apparatus, a device, and a storage medium for generating a page, where the page information includes front-end page information capable of drawing a page and back-end page information capable of generating background logic by caching the page information in a server, so that after receiving a page request (including, for example, a page drawing request and a page data request, or a page generation request) from a terminal, a target page is automatically generated based on the page generation logic provided by the present application, thereby improving the development efficiency of the page and reducing the development cost of the page.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 4 is a flowchart of a page generating method according to an embodiment of the present application. Referring to fig. 4, the page generation method includes:
s401, receiving a page drawing request from a terminal.
The page drawing request is used for requesting front page information of the target page. The target page may be a web page, for example.
When the user wants to obtain the target page, the user inputs a target page request on the browser of the terminal, and the terminal sends a page drawing request to the server based on the request.
S402, reading front-end page information corresponding to the page drawing request from the stored page information.
The page information is already cached in the server before the server receives the page draw request. Specifically, the page information may include, but is not limited to, front-end page information, back-end page information, and the back-end page information may include, but is not limited to, a correspondence between the front-end page information and the back-end page information.
And after the server receives the page drawing request, reading front-end page information from the cache.
S403, sending front-end page information to the terminal so that the terminal can draw the target page.
Correspondingly, the terminal receives the front-end page information and draws the target page according to the front-end page information.
It should be noted that the target page obtained at this time only satisfies the requirement of the target page in appearance, but cannot be used. To obtain a complete usable page, background logic configuration is also required for the drawn target page. Therefore, the terminal also requests back-end page information for configuring the back-end logic of the target page from the server. Specifically, the terminal sends a page data request to the server, wherein the page data request is used for requesting back-end page information of the target page. The back-end page information contains background logic corresponding to the drawn target page.
S404, receiving a page data request from the terminal.
S405, the back-end page information corresponding to the page data request is read in the page information.
And after receiving the page data request, the server reads back-end page information from the cache of the server. Optionally, the read back-end page information can be subjected to logical operations such as adding, deleting, checking and the like.
S406, sending back-end page information to the terminal so that the terminal can generate a target page.
Correspondingly, the terminal receives the back-end page information, binds the obtained back-end page information and front-end page information according to the corresponding relation between the back-end page information and the front-end page information contained in the back-end page information, and generates a target page.
The page generation method provided by the embodiment of the application has the advantages that the page information is stored in the server, the page information comprises front-end page information and back-end page information, the back-end page information comprises the corresponding relation between the front-end page information and the back-end page information, therefore, when a target page based on a B/S mode is generated, a user interacts with the terminal to enable the terminal to send a page drawing request to the server, the server responds to the page drawing request, reads the front-end page information corresponding to the page drawing request from the stored page information to obtain the front-end page information, sends a page data request to the server, reads the back-end page information corresponding to the page data request from the stored page information to obtain the back-end page information, and then generates the target page based on the obtained front-end page information and the back-end page information. The application can automatically render the front-end page with uniform structure and style without repeated development of the front-end page, and in addition, the development of background logic codes and database interaction codes for each function in the page is not needed, thereby saving labor cost and improving the development efficiency of the page.
On the basis, after the terminal receives the back-end page information, the back-end page information is stored in the terminal in the form of a document. Thus, in some embodiments, the target page that has been generated may also be modified. Specifically, some function buttons such as save, delete, import, export and submit approval exist on the generated target page. The background logic of the function buttons is dynamically generated according to page information, and code development of the background logic is not needed. The function buttons can be used for adding, deleting or modifying the back-end page information stored in the terminal, and when the addition, deletion or modification of the back-end page information is completed, the modification of the corresponding target page is automatically completed, namely, the background logic processing and the interaction with the database in the server are automatically completed. The development work of background logic codes and database interaction codes is not needed for each function, and the labor cost is saved.
In some embodiments, the front-end page information is in a non-hypertext markup language format. In this case, step S403 includes adjusting the format of the front-end page information to a HTML format to obtain HTML data, and transmitting the HTML data to the terminal.
Hypertext markup language, also known as HTML, is a markup language. It may be descriptive of text, graphics, animation, sound, forms, links, etc. In this embodiment, the original format of the front-end page information may be a JAVA object, which cannot be directly used to draw the target page. Therefore, the front page information in the JAVA object format is parsed into the front page information in the HTML format, and then the server can read the front page information in the HTML format to draw the target page.
Optionally, before receiving the page drawing request from the terminal, generating page information, wherein the page information generating process includes that, when starting, a configuration file is analyzed to obtain cache data, the configuration file includes the page information, and the cache data is loaded into a cache.
A configuration file may provide a unified page configuration scheme for pages of similar structure, and the configuration file may be generated using various formats, such as XML, excel, YML, TXT. The configuration files in the formats are generated independently of a designated editor or platform, and are supported to be configured on various text editors. For example, the text editor used in generating the XML formatted configuration file may be a Notepad, VSCode, IDEA, or notepad++. The cost of deployment and maintenance of the development platform is saved.
In some embodiments, parsing the configuration file to obtain cached data includes parsing page information in the configuration file into JAVA objects to obtain cached data. When the system is started, the configuration files in the formats are loaded into a system cache in a Java mode through JAXB (Java Architecture for XML Binding) technology, namely the configuration files are analyzed into Java objects to be cached in a server.
The JAXB can serialize a JAVA object into XML and reverse operation, parse XML into JAVA object.
Optionally, before the configuration file is parsed to obtain the cached data at the time of starting, the method further comprises the step of obtaining and storing the configuration file. The configuration file is of a query list type and/or a paging list type, the configuration file of the query list type is used for generating a target page of the list page type, and the configuration file of the paging list type is used for generating a target page of the list page type.
The configuration files can be XML-format files, and the configuration files in the XML format are generally divided into two types, namely a query list type and a paging list type, wherein the configuration files in the query list type are used for generating a target page in the list page type, and the target page in the list page type refers to a target page capable of detecting a plurality of pieces of data at one time. The target page of the list page type generally includes a query area and a list data area when displayed. The configuration file of the form type is used for generating a target page of the form page type, and the target page of the form page type refers to a target page for displaying one piece of data. Generally, two types of files, namely a query list and a paging list, exist in the configuration file at the same time.
For example, the following table 1 is an exemplary table of a query list type configuration file provided in this embodiment, and element nodes in table 1, for example, "pages", may also be called tags, where the element nodes cover all functions of a target page, for example, a table tag in a page is used to define a relationship between a page and a database, and a title in a page is used to make a page. In addition, the functionality can be dynamically extended by defining new element nodes.
Table 1 example table of profiles for query list types
Table 2 below is an exemplary table of the configuration file of the page list type provided in this embodiment. Similar to Table 1, the element nodes in Table 2, e.g., "pages", may also be referred to as tags, cover all functions of the target page, e.g., table tags in pages are used to define page-to-database relationships and titles in pages are used to make pages. In addition, the functionality can be dynamically extended by defining new element nodes. The labels can be divided into form labels and list labels, the labels in table 2 are form labels, the labels in table 1 are list labels, and the labels form a target page. Illustratively, the query area is comprised of form tags and the list data area is comprised of list tags. The intersection of the partial tags may be found to exist in both table 1 and table 2.
Table 2 example configuration file table of paging list type
Fig. 5 is a flowchart of a page generating method according to another embodiment of the present application. As shown in fig. 5, the page generation method includes:
s501, receiving a page generation request from a terminal.
And when the terminal needs to generate the target page, sending a page generation request to a server. The page generation request is for requesting generation of a target page.
S502, reading front-end page information and back-end page information corresponding to the page generation request from the stored page information.
The page information is stored in the server before receiving the page generation request from the terminal, and the page information comprises front-end page information for drawing the target page and back-end page information of background logic for generating the target page. In addition, in some embodiments, the back-end page information further includes a correspondence between the front-end page information and the back-end page information, where the correspondence between the front-end page information and the back-end page information enables the background logic to bind with the drawn target page.
S503, sending front end page information and back end page information to the terminal for the terminal to generate a target page.
In some embodiments, the front page information needs to be converted to HTML format to be readable by the terminal and rendered into the target page. And the back-end page information can form a document and is stored in the terminal, and the back-end page information and the drawn target page can be bound to generate a complete target page.
It can be understood that the specific generation process of the page information in the page generation method shown in fig. 4 is also applicable to the page generation method shown in fig. 5, and will not be described herein.
According to the page generation method, since the page information is stored in the server, the page information comprises front-end page information and back-end page information, and the back-end page information comprises a corresponding relation between the front-end page information and the back-end page information. Therefore, when the terminal wants to generate the target page, the page generation request can be directly transmitted to obtain the page information, and then the target page is generated based on the obtained page information. By developing the page by the method, the development efficiency of the page can be improved.
In summary, the present application has at least the following advantages:
1. a unified page configuration scheme is provided for the target pages with similar structures;
2. The configuration on the common text editor is supported without depending on a designated editor or platform in the process of generating the target page, so that the cost of deployment and maintenance of a development platform is saved;
3. And when the program runs, automatically generating a target page with uniform structure and style according to the configuration file. Repeated page development work is not required.
The following are examples of the apparatus of the present application that may be used to perform the method embodiments of the present application. For details not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the method of the present application.
Fig. 6 is a schematic structural diagram of a page generating apparatus according to an embodiment of the present application. The embodiment of the application provides a page generation device. As shown in fig. 6, the page generating apparatus 60 includes a receiving module 601, a reading module 602, and a transmitting module 603. Wherein:
The receiving module 601 is configured to receive a page drawing request from a terminal, where the page drawing request is used to request front-end page information of a target page, and receive a page data request from the terminal, where the page data request is used to request back-end page information of the target page.
The reading module 602 is configured to read front-end page information corresponding to a page drawing request from stored page information, and read back-end page information corresponding to a page data request from the page information.
The sending module 603 is configured to send front-end page information to the terminal for the terminal to draw a target page, and send back-end page information to the terminal for the terminal to generate the target page.
Optionally, the front-end page information is in a non-hypertext markup language format, and the sending module 803 is specifically configured to adjust the format of the front-end page information to a hypertext markup language format to obtain hypertext markup language data, and send the hypertext markup language data to the terminal.
Optionally, the receiving module 601 is further configured to parse a configuration file to obtain cache data when starting, where the configuration file includes page information, and load the cache data into the cache.
Optionally, the receiving module 601 parses the configuration file to obtain the cached data, and is specifically configured to parse the page information in the configuration file into a JAVA object to obtain the cached data.
In some embodiments, the receiving module 601 is further configured to obtain and store a configuration file, where the configuration file is a query list type and/or a paging list type, the configuration file of the query list type is used to generate a target page of the list page type, and the configuration file of the paging list type is used to generate a target page of the list page type.
Fig. 7 is a schematic structural diagram of a page generating apparatus according to another embodiment of the present application. As shown in fig. 7, the page generating apparatus 70 includes a receiving module 701, a reading module 702, and a transmitting module 703. Wherein:
The receiving module 701 is configured to receive a page generation request from a terminal, where the page generation request is used to request generation of a target page.
The reading module 702 is configured to read front-end page information and back-end page information corresponding to the page generation request from the stored page information.
And the sending module 703 is configured to send the front-end page information and the back-end page information to the terminal, so that the terminal can generate the target page.
It should be noted that, the page generating apparatus provided in the embodiment of the present application may be used to execute the corresponding page generating method embodiment, and its implementation principle and technical effects are similar, and will not be described again.
It should be noted that, it should be understood that the division of the modules of the above apparatus is merely a division of a logic function, and may be fully or partially integrated into a physical entity or may be physically separated. The modules can be realized in the form of software which is called by the processing element, in the form of hardware, in the form of software which is called by the processing element, and in the form of hardware. For example, the processing module may be a processing element that is set up separately, may be implemented in a chip of the above-mentioned apparatus, or may be stored in a memory of the above-mentioned apparatus in the form of program codes, and the functions of the above-mentioned processing module may be called and executed by a processing element of the above-mentioned apparatus. The implementation of the other modules is similar. In addition, all or part of the modules can be integrated together or can be independently implemented. The processing element here may be an integrated circuit with signal processing capabilities. In implementation, each step of the above method or each module above may be implemented by an integrated logic circuit of hardware in a processor element or an instruction in a software form.
For example, the modules above may be one or more integrated circuits configured to implement the methods above, such as one or more Application SPECIFIC INTEGRATED Circuits (ASICs), or one or more microprocessors (DIGITAL SIGNAL processors, DSPs), or one or more field programmable gate arrays (field programmable GATE ARRAY, FPGAs), or the like. For another example, when a module above is implemented in the form of processing element scheduler code, the processing element may be a general purpose processor, such as a central processing unit (central processing unit, CPU) or other processor that may invoke the program code. For another example, the modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions in accordance with embodiments of the present application are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.) means from one website, computer, server, or data center. Computer readable storage media can be any available media that can be accessed by a computer or data storage devices, such as servers, data centers, etc., that contain an integration of one or more available media. Usable media may be magnetic media (e.g., floppy disks, hard disks, magnetic tape), optical media (e.g., DVD), or semiconductor media (e.g., solid state disk STATE DISK (SSD)), among others.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application. Referring to fig. 8, the electronic device 80 includes a memory 801 and a processor 802. Wherein the memory 801 is for storing executable instructions and the processor 802 is configured to execute the executable instructions to implement the page generation method described above.
Fig. 9 is a block diagram illustrating an apparatus for implementing a page generation method according to an exemplary embodiment. For example, the apparatus 90 may be provided as a server. Referring to fig. 9, apparatus 90 includes a processing component 901 that further includes one or more processors and memory resources represented by memory 902 for storing instructions, such as applications, executable by processing component 901. The application program stored in the memory 902 may include one or more modules each corresponding to a set of instructions. Further, the processing component 901 is configured to execute instructions to perform the page generation method described above.
The apparatus 90 may further comprise a power supply component 903 configured to perform power management of the apparatus 90, a wired or wireless network interface 904 configured to connect the apparatus 90 to a network, and an input output (I/O) interface 905. The device 90 may operate based on an operating system stored in the memory 902, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, or the like.
The embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores computer execution instructions which are used for realizing the page generation method when being executed by a processor.
The computer readable storage medium described above may be implemented by any type of volatile or non-volatile memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk. Computer readable storage media can be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary readable storage medium is coupled to the processor such the processor can read information from, and write information to, the readable storage medium. In the alternative, the readable storage medium may be integral to the processor. The processor and the readable storage medium may reside in an Application SPECIFIC INTEGRATED Circuits (ASIC). Of course, the processor and the readable storage medium may reside as discrete components in a sensing device for a perception hole.
The embodiment of the application also provides a computer program product, which comprises a computer program, wherein the computer program realizes the page generation method when being executed by a processor.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of implementing the various method embodiments described above may be implemented by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs the steps comprising the method embodiments described above, and the storage medium described above includes various media capable of storing program code, such as ROM, RAM, magnetic or optical disk.
Finally, it should be noted that the foregoing embodiments are merely for illustrating the technical solutions of the present disclosure, and not for limiting the same, and although the present disclosure has been described in detail with reference to the foregoing embodiments, it should be understood by those skilled in the art that the technical solutions described in the foregoing embodiments may be modified or some or all of the technical features may be equivalently replaced, and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present disclosure.