The content of the invention
It is of the invention by the detection according to memory size space to solve the problems of above-mentioned prior art, so that
The conversion of JSON forms is realized according to predetermined condition, thus provides a kind of page generation based on JSON forms and display side
Method, including:Receive the page load request for carrying out self terminal;The page based on JSON forms is obtained according to the page load request
Configuration file;The memory source number taken is needed according to the page configuration file calculating page based on JSON forms
Amount;Obtain the reserved memory source quantity pre-set;Memory requirements total amount is calculated, the memory requirements total amount is equal to the page
Face needs the memory source quantity taken and the reserved memory source quantity sum;Calling system explorer, calculate and work as
Preceding free memory resource quantity;If the memory requirements total amount is less than the currently available memory source quantity, with whole
Load mode loads the page;If the memory requirements total amount is more than or equal to the currently available memory source quantity,
The page configuration file based on JSON forms is then converted into the page configuration file based on XML format and partly to load
Mode loads the page.
Preferably, it is described to be included with whole load modes loading page:Parse the page configuration of the JSON forms
File, obtains the attribute information of all page elements, and all page elements include multiple page elements groups;Will be described all
The attribute information of page elements is disposably read in internal memory;The size value of each page elements group is calculated, the scale-value includes
Width value and length value;Page size value is calculated using the size value of each page elements group, and according to the page chi
Very little value generation initial page;All page members are configured in the initial page according to the attribute information of all page elements
Part is to generate the page.The page is sent to the terminal and shown.
Preferably, the size value for calculating each page elements group includes:Every page is calculated respectively according to below equation
The width value and length value of face element group:Wherein, WiFor i-th
The width value of page elements group, WijFor the width value of j-th of page elements in i-th of page elements group, CijFor i-th of page
Lateral separation in element group between+1 page elements of j-th of page elements and jth, LiFor the length of i-th of page elements group
Angle value, LijFor the length value of j-th of page elements in i-th of page elements group, DijFor j-th page in i-th of page elements group
Fore-and-aft distance between+1 page elements of bin part and jth.
Preferably, it is described to be included with the part load mode loading page:Parse the page configuration text of the XML format
Part, obtain the attribute information for the multiple page elements for belonging to the 1st page elements group in all page elements, all pages
Element includes multiple page elements groups;The attribute information of multiple page elements of the 1st page elements group is read in into internal memory
In;The size value of the 1st page elements group is calculated, the scale-value includes width value and length value;Utilize described 1st
The size value of page elements group calculates page size value, and generates initial page according to the page size value;According to the described 1st
The attribute information of multiple page elements in individual page elements group configured in the initial page the multiple page elements with
Generate the page;The page is sent to the terminal and shown..
Preferably, the size value for calculating the 1st page elements group includes:Calculate respectively according to below equation
The width value and length value of 1 page elements group:Wherein,
W1For the width value of the 1st page elements group, W1jFor the width value of j-th of page elements in the 1st page elements group, C1jFor
Lateral separation in 1 page elements group between+1 page elements of j-th of page elements and jth, L1For the 1st page elements
The length value of group, L1jFor the length value of j-th of page elements in the 1st page elements group, D1jFor in the 1st page elements group
Fore-and-aft distance between+1 page elements of j-th of page elements and jth.
Preferably, methods described is also included in response to default time conditions, with handling in all page elements
The 1st same mode of page elements group handle the 2nd page elements group and other page elements in all page elements
Group.
Preferably, the attribute information includes configuration information in page elements essential information, page elements grouping information, group
And configuration information between group.
Preferably, before the 2nd page elements group in handling all page elements, in addition to will be according to described 1st
The attribute information of multiple page elements in page elements group configures the multiple page elements with life in the initial page
Into the page store into external memory storage, then remove interior shared by the 1st page elements group in all page elements
Deposit space.
Preferably, show in all page elements the 2nd page elements group generation the page while no longer
Show the page of the 1st page elements group generation in all page elements.
Compared with prior art, the present invention according to page load request parse simultaneously final the present invention completely by server end
The page is generated, there is advantages below:
By the conversion that JSON forms are considered according to internal memory actual conditions so that can realize adaptation using the inventive method
The needs of different memory conditions, reduce the probability of system crash.
Judge actually available memory source by considering reserved memory source quantity so that the granularity that memory source judges
It is smaller, the accuracy of judgement Du Genggao of the actually available resource of internal memory.
By using whole load modes to the page configuration file of JSON forms, so as to improve actual pages loading speed
Degree.
By being XML format by the page configuration file translations of JSON forms and using part load mode, so as to overcome
The defects of JSON forms can not partly load.
Embodiment
Retouching in detail to one or more embodiment of the invention is hereafter provided together with the accompanying drawing for illustrating the principle of the invention
State.The present invention is described with reference to such embodiment, but the invention is not restricted to any embodiment.The scope of the present invention is only by right
Claim limits, and the present invention covers many replacements, modification and equivalent.Illustrate in the following description many details with
Thorough understanding of the present invention is just provided.These details are provided for exemplary purposes, and without in these details
Some or all details can also realize the present invention according to claims.
Fig. 1 shows the flow chart of the page generation according to embodiments of the present invention based on JSON forms and display methods.Such as
Shown in Fig. 1, in first step, the page load request for carrying out self terminal is received, the page load request is sent to clothes by terminal
The receiving module at business device end, the page load request show page configuration file, are absorbed in the present invention for JSON lattice
The processing of the page configuration file of formula.In second step, the page based on JSON forms is obtained according to the page load request
Configuration file, wherein, server end parses the page load request by parsing module, and according to the page load request
Instruction obtains the page configuration file based on JSON forms.In third step, according to the page based on JSON forms
Configuration file calculates the memory source quantity that the page needs to take, and wherein server end carries out above-mentioned meter by computing module
Calculate.In four steps, the reserved memory source quantity pre-set is obtained, server end obtains what is pre-set by acquisition module
Reserved memory source quantity, the reserved memory source quantity pre-set are for example counted according to historical record and determined.
Five steps, server end calculate memory requirements total amount using total amount computing module, and the memory requirements total amount is equal to the page
Need the memory source quantity that takes and the reserved memory source quantity sum.In the 6th step, calling system resource management
Device, currently available memory source quantity is calculated, wherein being called by the calling module of server end, is counted by computing module
Calculate.In the 6th step, made the following judgment by the judge module of server end:If the memory requirements total amount is less than described work as
Preceding free memory resource quantity, then load the page with whole load modes;If the memory requirements total amount is more than or waited
In the currently available memory source quantity, then the page configuration file based on JSON forms is converted to based on XML lattice
The page configuration file of formula simultaneously loads the page with part load mode.Wherein realized by the modular converter of server end above-mentioned
Conversion.
In embodiments of the present invention, it is described to be comprised the following steps with whole load modes loading page:Step 1, by taking
Business device end load-on module parses the page configuration file of the JSON forms first, obtains the attribute information of all page elements, wherein,
All page elements include multiple page elements groups.Step 2, insmoded by the internal memory of server end, by all pages
The attribute information of element is disposably read in internal memory, now due to having enough spaces in internal memory, therefore even if by all pages
The attribute information of bin part all reads in internal memory and thus the page of the generation comprising whole page elements will not also make internal memory overflow, i.e.,
The generation of system crash will not be caused.Step 3, calculates the size value of each page elements group, the scale-value include width value and
Length value, the step are calculated by the Size calculation module of server end.Wherein, each page is calculated respectively according to below equation
The width value and length value of element group:Its
In, WiFor the width value of i-th of page elements group, WijFor the width value of j-th of page elements in i-th of page elements group, Cij
For the lateral separation between+1 page elements of j-th of page elements and jth in i-th of page elements group, LiFor i-th of page
The length value of element group, LijFor the length value of j-th of page elements in i-th of page elements group, DijFor i-th of page elements
Fore-and-aft distance in group between+1 page elements of j-th of page elements and jth, it is clear that j is 1 and NiBetween integer, NiIt is
Page elements sum in i-th of page elements group.J-th of page elements and+1 page of jth in wherein i-th of page elements group
Lateral separation between bin part is the minimum abscissa value and the maximum horizontal seat of j-th of page elements of+1 page elements of jth
The difference of scale value.Fore-and-aft distance in wherein i-th of page elements group between+1 page elements of j-th of page elements and jth
Be+1 page elements of jth minimum ordinate value and j-th of page elements maximum ordinate value difference.In the present invention
The upper left position of other page elements in page elements group where the 1st page elements in each page elements group are respectively positioned on
Put.Step 4, page size value is calculated using the size value of each page elements group, and given birth to according to the page size value
Into initial page;Above-mentioned calculating is wherein carried out by the page size computing module of server end, by the initial page of server end
Generation module carries out above-mentioned generation.Step 5, matched somebody with somebody according to the attribute information of all page elements in the initial page
All page elements are put to generate the page;Above-mentioned configuration is wherein carried out by the configuration module of server end.Step 6, by institute
The page is stated to send to the terminal and shown.Wherein the page is sent to terminal by the sending module of server end,
And shown by the display module of terminal on terminal browser and state the page more.
In embodiments of the present invention, it is described to be included with the part load mode loading page:Step 1, parse the XML format
Page configuration file, obtain the attribute information for the multiple page elements for belonging to the 1st page elements group in all page elements, it is described
All page elements include multiple page elements groups.Wherein, carry out above-mentioned parsing and obtain to walk by the load-on module of the server end
Suddenly.Step 2, insmoded by the internal memory of server end by the attribute information reading of multiple page elements of the 1st page elements group
In internal memory.Now due to the related information of the 1st page elements group only is read in into internal memory, the page thus generated also will not be excessive, therefore
Memory headroom is sufficient for needing, therefore internal memory will not be made to overflow, i.e., will not cause the generation of system crash.Step 3, by server
The Size calculation module at end calculates the size value of the 1st page elements group, and the scale-value includes width value and length value.Wherein, institute
State and calculate the size value of the 1st page elements group and include:Calculated respectively according to below equation the 1st page elements group width value and
Length value:
Wherein, W1For the width value of the 1st page elements group, W1jFor the width value of j-th of page elements in the 1st page elements group, C1jFor
Lateral separation in 1st page elements group between+1 page elements of j-th of page elements and jth, L1For the 1st page elements group
Length value, L1jFor the length value of j-th of page elements in the 1st page elements group, D1jFor j-th page in the 1st page elements group
Fore-and-aft distance between+1 page elements of bin part and jth, it is clear that j is 1 and N1Between integer, N1It is the 1st page elements
Page elements sum in group.In wherein the 1st page elements group between+1 page elements of j-th of page elements and jth
Lateral separation is the difference of the minimum abscissa value and the maximum abscissa value of j-th of page elements of+1 page elements of jth.Its
In fore-and-aft distance in i-th of page elements group between+1 page elements of j-th of page elements and jth be+1 page of jth
The difference of the maximum ordinate value of the minimum ordinate value of element and j-th of page elements.Every 1 page elements in the present invention
The upper left position of other page elements in page elements group where the 1st page elements in group are respectively positioned on.Step 4, profit
Page size value is calculated with the size value of the 1st page elements group, and initial page is generated according to the page size value;Its
In above-mentioned calculating carried out by the page size computing module of server end, carried out by the initial page generation module of server end
State generation.Step 5, the attribute information of multiple page elements in the 1st page elements group is in the initial page
The multiple page elements are configured to generate the page;Above-mentioned configuration is wherein carried out by the configuration module of server end.Step
Six, the page is sent to the terminal and shown.Wherein the page is sent by the sending module of server end
To terminal, and shown by the display module of terminal on terminal browser and state the page more.
In embodiments of the present invention, methods described is also included in response to default time conditions, with described all with processing
The same mode of the 1st page elements group in page elements handle the 2nd page elements group in all page elements and other
Page elements group.In first embodiment, in the attribute of 1st page elements group of the server end in all page elements
After information ultimately generates the page and shown after sending to terminal on terminal browser, in response to timeline set in advance
Part, such as triggered by timing, continue the category of the 2nd page elements group in all page elements by server end
Property information regenerate the new page and send to terminal, and there is terminal to be shown.For in all page elements
The processing of 2nd page elements group is identical with the above-mentioned processing mode to the 1st page elements group.In second embodiment, taking
The attribute information for 1st page elements group of the device end in all page elements of being engaged in ultimately generates the page and sent to terminal
Afterwards, synchronously follow the steps below:On the one hand, the page is shown by terminal, on the other hand, continued in server end according to
The attribute information of the 2nd page elements group in all page elements regenerates the new page.Afterwards, proceed to respond to set in advance
Fixed time conditions, such as triggered by timing, the new page is sent to terminal, and continue the synchronous terminal that carries out and show
Show the step of regenerating the page with server end.The processing to subsequent page element group with it is above-mentioned to the 1st page elements group
Processing mode it is identical.It should be evident that the mode of second embodiment causes the time cost that the page generates to be greatly lowered.
In embodiments of the present invention, the attribute information in page elements essential information, page elements grouping information, group including matching somebody with somebody confidence
Configuration information between breath and group, that is to say, that attribute information contains all basic elements of the page ultimately generated.
In embodiments of the present invention, before the 2nd page elements group in handling all page elements, in addition to by basis
The attribute information of multiple page elements in the 1st page elements group configures the multiple page member in the initial page
Part is stored into external memory storage with the page generated, is then removed shared by the 1st page elements group in all page elements
Memory headroom.Wherein, the purpose being transferred in external memory storage is to realize the purpose of recycling.For example, in response to
Default trigger condition, such as user's input, server end is by a page in the multiple pages stored in external memory storage
Terminal is sent directly to, and is shown by terminal.Also include in embodiments of the present invention:Display is according to all page members
The 1st page member in all page elements is no longer shown while the page of the 2nd page elements group generation in part
The page of part group generation, that is, realize the refresh process from prevpage face to the latter page
In summary, page generation and display methods proposed by the present invention based on JSON forms so that the application present invention
Method can realize the needs for adapting to different memory conditions, reduce the probability of system crash;So that the granularity that memory source judges
It is smaller, the accuracy of judgement Du Genggao of the actually available resource of internal memory;Improve actual pages loading velocity;Overcome JSON forms not
The defects of partly loading etc. beneficial technique effect.
It should be appreciated that the above-mentioned embodiment of the present invention is used only for exemplary illustration or explains the present invention's
Principle, without being construed as limiting the invention.Therefore, that is done without departing from the spirit and scope of the present invention is any
Modification, equivalent substitution, improvement etc., should be included in the scope of the protection.In addition, appended claims purport of the present invention
Covering the whole changes fallen into scope and border or this scope and the equivalents on border and repairing
Change example.