Specific embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouchedThe specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order toConvenient for description, part relevant to related invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phaseMutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is shown can the method for generating the page using the embodiment of the present application or the device for generating the pageExemplary architecture 100.
As shown in Figure 1, system architecture 100 may include terminal device 101,102,103, network 104 and server 105.Network 104 between terminal device 101,102,103 and server 105 to provide the medium of communication link.Network 104 can be withIncluding various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 101,102,103 and be interacted by network 104 with server 105, to receive or send outSend message etc..Various client applications can be installed on terminal device 101,102,103, such as Integrated Development Environment (IDE,Integrated Development Environment) class application, web browser applications, instant messaging tools, text volumeCollect class application, the application of browser class etc..
Terminal device 101,102,103 can be hardware, be also possible to software.When terminal device 101,102,103 is hardWhen part, it can be the various electronic equipments with display screen, including but not limited to smart phone, tablet computer, e-book readingDevice, pocket computer on knee and desktop computer etc..When terminal device 101,102,103 is software, may be mounted atIn above-mentioned cited electronic equipment.Multiple softwares or software module may be implemented into (such as providing distributed clothes in itBusiness), single software or software module also may be implemented into.It is not specifically limited herein.
Server 105 can be to provide the server of various services, and for example, terminal device 101,102,103 is sent to itJSON formatted data background server.Background server can carry out JSON formatted data the processing such as analyzing, and will placeReason result (such as generating the page according to JSON formatted data) feeds back to terminal device.
It should be noted that the embodiment of the present application provided by for generate the page method can by terminal device 101,102, it 103 executes, can also be executed by server 105.Correspondingly, it can be set for generating the device of the page in terminal device101, it in 102,103, also can be set in server 105.
It should be noted that server can be hardware, it is also possible to software.When server is hardware, may be implementedAt the distributed server cluster that multiple servers form, individual server also may be implemented into.It, can when server is softwareTo be implemented as multiple softwares or software module (such as providing Distributed Services), single software or software also may be implemented intoModule.It is not specifically limited herein.
It should be understood that the number of terminal device, network and server in Fig. 1 is only schematical.According to realization needIt wants, can have any number of terminal device, network and server.It such as may include terminal device, network and serverEach one.Alternatively, only including terminal device without including network and server.Alternatively, only not including that terminal is set including serverStandby or network.Or including server and terminal device alternative one and network.
With continued reference to Fig. 2, the process of one embodiment of the method for generating the page according to the application is shown200.This be used for generate the page method the following steps are included:
Step 201, the JSON formatted data for describing target pages is obtained.
In the present embodiment, for generate the method for the page executing subject (such as terminal device shown in FIG. 1 101,102,103 or server 105) can obtain by various modes description target pages JSON formatted data.Such as: Yong HukeTo send one section for describing the JSON formatted data of the page to executing subject by user terminal, executing subject receives this section of JSONFormatted data;Or user directly can input one section of JSON formatted data to executing subject.Above-mentioned target pages be user according toActual demand, the page for finally needing to generate.
In the present embodiment, in general, target pages are to be formed by one or more components with certain arrangement mode.CauseThis, can be divided into one or more components according to the function of target pages.Therefore, it can use JSON formatted data to retouchComponent is stated so that target pages to be described.The JSON formatted data for describing target pages includes: included by target pagesComponent type, component type value, the component type of component are worth the attribute and attribute value of corresponding component.With following first segment JSONIllustrate for formatted data:
In above-mentioned JSON formatted data, component type is " type ", and the value of corresponding component type is " page ".Component classThere are three the attributes of the corresponding component of offset " page ", is respectively as follows: " title ", " subTitle " and " body ".And " title "Corresponding attribute value is " this is title ", and " subTitle " corresponding attribute value is " this is subtitle ", " body " corresponding categoryProperty value be " { " type ": " form " } ".
Step 202, according to component type value, component is searched in preset assembly set as target element.
In the present embodiment, component type value and the corresponding relationship of the component in preset assembly set are preset.It is rightIn each component type value, corresponding component can be found in assembly set as target element.
For example, the component in assembly set can be the component registered in advance, by the component and group after registrationThe association of part types value.Specifically, for example, the path added automatically to the node of each of JSON formatted data part types valueRegistration information and routing information are associated by information in component registration, i.e. the registration information knot that may indicate that routing informationComponent type value in tail is the component type value with the component liaison of the registration.Still it is with one section of above-mentioned JSON formatted dataExample adds its routing information in the node of " page " to the component type value in above-mentioned JSON formatted data.Correspondingly, pre-If being had registered in assembly set and the associated page component of above-mentioned routing information.Then this component type value is the node of " page "It can be identified, i.e., can realize and corresponding component is found as target element by component type value.Likewise,The node of component type value " form " adds paths information automatically, such as " page/body/0/form ", correspondingly, in description componentsIt is had registered in set and the associated form component of the routing information, the i.e. registration information of form component in the description components setShow the node that all paths are ended up with " form ", is all the node for calling the form component, in this way, in the component type valueWhen identified for the node of " form ", so that it may find form component in description components as target element.
In the present embodiment, optionally, the component in assembly set includes but is not limited to following at least one: the page(page) component, list (form) component, Text Entry (txet) component, radio box (Radios) component, button(button) component.
Step 203, the attribute and attribute value of corresponding component are worth according to component type, updates the respective attributes of target elementAnd attribute value.
Executing subject is after finding target element, according to the component type value pair in step 201 in JSON formatted dataThe attribute and attribute value for the component answered can update the respective attributes and attribute value of target element.It should be noted that target groupThe attribute and attribute value of part can characterize the attribute such as label, title, movement, interface configuration of corresponding component.Still with above-mentionedFirst segment JSON formatted data for, after executing subject finds target element page, according to the corresponding component of the componentAttribute and attribute value " " title ": " this is title ", " subTitle ": " this is subtitle ", " body ": { " type ": "Form " } " update the target element, i.e., " this is title " and " this is subtitle " can be shown in the component that such offset is pageText, and be also nested in the page component component that component type value is form.
In the present embodiment, the respective attributes of target element and attribute value are assigned to target element, there is target elementCorresponding attribute.
Step 204, it is based on updated target element, generates target pages.
In the present embodiment, by above-mentioned steps 203, the corresponding attribute of target element and attribute value are updated.Updated target element may include the attribute informations such as the label for having component, title, and it is possible to according to above-mentioned JSON formatData, the routing information of securing component types value.And routing information can reflect the location information of component.According to determining positionInformation may finally generate target pages.
Still by taking first segment JSON formatted data as an example, the path of component type value " form " is " page/body/0/Form " can reflect out form component and be located in page component.Therefore, in the target pages of generation, page component is located at bottomLayer, form component are disposed thereon.
With continued reference to the signal that Fig. 3, Fig. 3 are according to the application scenarios of the method for generating the page of the present embodimentFigure.In the application scenarios of Fig. 3, terminal device 301 first obtains the JSON formatted data for describing the page.The JSON format numberAccording to include target pages included by component component type, component type value, component type be worth corresponding component attribute andAttribute value.JSON formatted data in the terminal device 301 of Fig. 3 is identical as above-mentioned first segment JSON formatted data, the JSON latticeIn formula data, component type is " type ", and the value of corresponding component type is " page ".Corresponding group of component type value " page "There are three the attributes of part, is respectively as follows: " title ", " subTitle " and " body ".And " title " corresponding attribute value is that " this isTitle ", " subTitle " corresponding attribute value are " this is subtitle ", and " body " corresponding attribute value is " { " type ": "form"}".It again include component type in " body " corresponding attribute value for " type ", component type value is the component of " form ".Terminal device 301 can be searched in preset assembly set and component class according to component type value " page " and " form " laterOffset is " page " and " form " corresponding component as target element (page component and form component), in the assembly setComponent is the component registered in advance.Further according to the attribute and attribute of component type value " page " and " form " corresponding componentValue " " title ": " this is title ", " subTitle ": " this is subtitle ", " body ": { " type ": " form " } " updates meshMark the respective attributes and attribute value of component.Based on updated target element (page component and form component), page object is generatedFace.
The method provided by the above embodiment for generating the page of the application is obtained for describing target pages firstJSON formatted data, above-mentioned JSON formatted data include the type of component included by target pages, component type value, component classThe attribute and attribute value of the component of the corresponding component of offset.Then it according to said modules types value, is looked into description components setLook for component as target element, the component in said modules set is the component registered in advance.Further according to said modules classThe attribute and attribute value of the corresponding component of offset update the respective attributes and attribute value of target element.Finally, being based on above-mentioned updateTarget element afterwards generates target pages.Mode can generate the page, and letter based on JSON formatted data through the foregoing embodimentPage generating mode is changed.
With further reference to Fig. 4, it illustrates the processes 400 of another embodiment of the method for generating the page.The useIn the process 400 for the method for generating the page, comprising the following steps:
Step 401, the JSON formatted data for describing target pages is obtained.
In the present embodiment, for generate the method for the page executing subject (such as terminal device shown in FIG. 1 101,102,103 or server 105) can obtain by various modes description target pages JSON formatted data.
In the present embodiment, in general, target pages are to be formed by one or more components with certain arrangement mode.CauseThis, can be divided into one or more components according to the function of target pages.Therefore, it can use JSON formatted dataComponent is described so that target pages to be described.The JSON formatted data for describing target pages includes included by target pagesComponent type, component type value, the component type of component are worth the attribute and attribute value of corresponding component.
In the present embodiment, optionally, the attribute value of the corresponding component of said modules types value may include for groupThe value that part behavior is configured.Specific component behavior may include at least one of following: send request, pop-up content, duplicationContent, submission form, updates target element, closes prompting frame page jump.That is, said modules types value is correspondingThe attribute value of component can be the value to component progress said modules behavior configuration.Such as: " actionType ": " copy ", "Content ": " contents value " } for the attribute value of a certain component, the component behavior for specially carrying out reproducting content to component is matchedThe attribute value set.Optionally, the attribute value of the corresponding component of said modules types value can also be included at least one of the following: and be takenThe address and page jump address that business device is communicated.Illustrate by taking following second segment JSON formatted datas as an example:
Attribute value is the code of " put:/api/customer " in this section of JSON formatted data, to be to component type valueThe address that the component of " form " is communicated with server.
Step 402, according to component type value, component is searched in preset assembly set as target element.
The specific processing of the step 402 and its brought technical effect can be with reference to the steps in the corresponding embodiment of Fig. 2Rapid 202, details are not described herein.
Step 403, the attribute and attribute value of corresponding component are worth according to component type, updates the respective attributes of target elementAnd attribute value.
Executing subject is after finding target element, according to the component type value pair in step 401 in JSON formatted dataThe attribute and attribute value for the component answered can update the respective attributes and attribute value of target element.It is understood that target groupThe attribute and attribute value of part can characterize the attribute such as label, title, movement, interface configuration of corresponding component.Still with above-mentionedFirst segment JSON formatted data for, after executing subject finds target element page, according to the corresponding component of the componentAttribute and attribute value " " title ": " this is title ", " subTitle ": " this is subtitle ", " body ": { " type ": "Form " } " have updated the target element." this is title " can be shown in the component that i.e. such offset is page and " this is secondary markThe text of topic ", and the component that component type value is form is also nested in the page component.With above-mentioned second segment JSONFor formatted data, after executing subject finds the component that component type value is " form ", according to the corresponding component category of the componentProperty and attribute value " " api ": " put:/api/customer " " have updated the attribute and attribute value of the form component, as shouldForm component Configuration one address for being communicated with server can specifically pass through application call interface apiIt is communicated with server.
In the present embodiment, the respective attributes of target element and attribute value are assigned to target element, have target elementThere is corresponding attribute.
Step 404, according to JSON formatted data, the routing information of securing component types value.
Executing subject can be according to above-mentioned JSON formatted data, the routing information of securing component types value.It is understood thatIt is that JSON formatted data itself can pass through component type value place in JSON formatted data there are multiple with identified nodeNode, the available routing information to corresponding assembly types value.For example, in first segment JSON formatted data, component classOffset " form " belongs to the part attribute value for the component that component type value is " page ", and the path of corresponding node is " page/body/0/form”。
Step 405, according to routing information, the function of target element and the position in target pages are determined, and is based onIdentified position generates target pages.
The routing information obtained by step 404, the relative positional relationship of available component.Still with first segment JSON latticeFormula data instance, node where component type value " page " are root node, and path is " page ".Therefore, corresponding componentPositioned at the bottom of target pages.And the path of component type value " form " is " page/body/0/form ", is believed by the pathBreath is it is found that form component is located in page component.That is, page component, which is equivalent to one, has the function for accommodating other assembliesThe container assemblies of energy, and the path just reflects the positional relationship of form component Yu page component.I.e. in target pages, formComponent is located in page component.
In the present embodiment, the component that executing subject is called all is packaged component, and component has been defined and is propped upThe component behavior held, and these encapsulation process are the well-known techniques studied and applied extensively at present, details are not described herein.
Based on the component behavior that component is supported, the configuration of component behavior can be carried out to component.Such as JSON formatted dataIn component type to be worth the attribute value of corresponding component may include the value configured to component behavior.By the attribute value assignmentTo corresponding target element, then the component in target pages generated can complete corresponding row during page operationFor.But even component type is worth identical component, in the attribute that different component types is worth corresponding component, functionIt can be not necessarily identical.By taking types value is the component of " text " as an example, being located in form component then has the function of input frame, and works asIt is located at outside form component, then has the function of textual presentation.It should be noted that these functions carry out in registration process in componentIt is associated with routing information, defines the corresponding function of component of different routing informations.Therefore, passage path information can be trueSet the goal the function of component.
Pass through the step, it is determined that the function of target element and the position in target pages, in the target pages of generationComponent be also provided with corresponding function.
Figure 4, it is seen that the method for generating the page compared with the corresponding embodiment of Fig. 2, in the present embodimentProcess 400 highlight based on target element generate target pages process.The scheme of the present embodiment description can be based on as a result,JSON formatted data generates the page, and the component property value in JSON formatted data is assigned to corresponding target element, and rootAccording to the routing information of JSON formatted data securing component types value, the function of target element and the position in target pages are determinedIt sets, simplifies page generating mode, and the target element in the page generated is the component with corresponding function.
With further reference to Fig. 5, as the realization to method shown in above-mentioned each figure, this application provides for generating the pageOne embodiment of device, the Installation practice is corresponding with embodiment of the method shown in Fig. 2, which specifically can be applied toIn various electronic equipments.
As shown in figure 5, the device 500 provided in this embodiment for generating the page includes acquiring unit 501, searching unit502, updating unit 503 and page generating unit 504.Wherein, acquiring unit 501 are configured to obtain for describing page objectThe JSON formatted data in face, wherein JSON formatted data includes the component type and component class of component included by target pagesOffset, component type are worth the attribute and attribute value of corresponding component;Searching unit 502, is configured to according to component type value,Component is searched in preset assembly set as target element, wherein the component in assembly set is the group registered in advancePart;Updating unit 503 is configured to be worth according to component type the attribute and attribute value of corresponding component, updates target elementRespective attributes and attribute value;Page generating unit 504 is configured to generate target pages based on updated target element.
In the present embodiment, in the device 500 for generating the page: acquiring unit 501, searching unit 502, updating unit503 and page generating unit 504 specific processing and its brought technical effect can be respectively with reference in Fig. 2 corresponding embodimentStep 201, step 202, the related description of step 203 and step 204, details are not described herein.
In some optional implementations of the present embodiment, above-mentioned page generating unit is further configured to basisJSON formatted data, the routing information of securing component types value;According to routing information, the function of target element is determined and in targetPosition in the page, and based on identified position, generate target pages.
In some optional implementations of the present embodiment, the attribute value that component type is worth corresponding component includes being used forThe value that component behavior is configured.
In some optional implementations of the present embodiment, component behavior includes at least one of the following: transmission request, bulletContent, reproducting content, page jump, submission form, update target element, closing prompting frame out.
In some optional implementations of the present embodiment, the attribute value that component type is worth corresponding component includes followingAt least one of: the jump address of the address and the page that are communicated with server.
The device provided by the above embodiment of the application, firstly, being obtained by acquiring unit 501 for describing target pagesJSON formatted data, the JSON formatted data include component included by target pages component type and component type value,Component type is worth the attribute and attribute value of corresponding component.Again by searching for unit 502 according to component type value, at preset groupComponent is searched in part set as target element, the component in the assembly set is the component registered in advance.Pass through laterUpdating unit 503 is worth the attribute and attribute value of corresponding component according to component type, updates the respective attributes and category of target elementProperty value.It is based on updated target element finally by page generating unit 504, generates target pages.
Below with reference to Fig. 6, it illustrates the computer systems 600 for the electronic equipment for being suitable for being used to realize the embodiment of the present applicationStructural schematic diagram.Electronic equipment shown in Fig. 6 is only an example, function to the embodiment of the present application and should not use modelShroud carrys out any restrictions.
As shown in fig. 6, computer system 600 includes central processing unit (CPU) 601, it can be read-only according to being stored inProgram in memory (ROM) 602 or be loaded into the program in random access storage device (RAM) 603 from storage section 608 andExecute various movements appropriate and processing.In RAM 603, also it is stored with system 600 and operates required various programs and data.CPU 601, ROM 602 and RAM 603 are connected with each other by bus 604.Input/output (I/O) interface 605 is also connected to alwaysLine 604.
I/O interface 605 is connected to lower component: the importation 606 including keyboard, mouse etc.;It is penetrated including such as cathodeThe output par, c 607 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 608 including hard disk etc.;And the communications portion 609 of the network interface card including LAN card, modem etc..Communications portion 609 via such as becauseThe network of spy's net executes communication process.Driver 610 is also connected to I/O interface 605 as needed.Detachable media 611, such asDisk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 610, in order to read from thereonComputer program be mounted into storage section 608 as needed.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart descriptionSoftware program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on computer-readable mediumOn computer program, which includes the program code for method shown in execution flow chart.In such realityIt applies in example, which can be downloaded and installed from network by communications portion 609, and/or from detachable media611 are mounted.When the computer program is executed by central processing unit (CPU) 601, limited in execution the present processesAbove-mentioned function.
It should be noted that the computer-readable medium of the application can be computer-readable signal media or computerReadable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but it is unlimitedIn system, device or the device of --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, or any above combination.It calculatesThe more specific example of machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, portable of one or more conducting wiresFormula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable programmable read only memory(EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device orThe above-mentioned any appropriate combination of person.In this application, computer readable storage medium can be it is any include or storage programTangible medium, which can be commanded execution system, device or device use or in connection.And in this ShenPlease in, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal,In carry computer-readable program code.The data-signal of this propagation can take various forms, including but not limited toElectromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be computer-readableAny computer-readable medium other than storage medium, the computer-readable medium can send, propagate or transmit for byInstruction execution system, device or device use or program in connection.The journey for including on computer-readable mediumSequence code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentionedAny appropriate combination.
The calculating of the operation for executing the application can be write with one or more programming languages or combinations thereofMachine program code, the programming language include object-oriented programming language-such as Java, Smalltalk, C++,It further include conventional procedural programming language-such as " C " language or similar programming language.Program code can be withIt fully executes, partly execute on the user computer on the user computer, being executed as an independent software package, portionDivide and partially executes or executed on a remote computer or server completely on the remote computer on the user computer.?Be related in the situation of remote computer, remote computer can pass through the network of any kind --- including local area network (LAN) orWide area network (WAN)-be connected to subscriber computer, or, it may be connected to outer computer (such as mentioned using Internet serviceIt is connected for quotient by internet).
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the application, method and computer journeyThe architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generationA part of one module, program segment or code of table, a part of the module, program segment or code include one or more useThe executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in boxThe function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actuallyIt can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuseMeaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holdingThe dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instructionCombination realize.
Being described in unit involved in the embodiment of the present application can be realized by way of software, can also be by hardThe mode of part is realized.Described unit also can be set in the processor, for example, can be described as: a kind of processor, packetInclude acquiring unit, searching unit, updating unit, page generating unit.Wherein, the title of these units is not under certain conditionsThe restriction to the unit itself is constituted, for example, acquiring unit is also described as " unit that JSON formatted data obtains ".
As on the other hand, present invention also provides a kind of computer-readable medium, which be can beIncluded in device described in above-described embodiment;It is also possible to individualism, and without in the supplying device.Above-mentioned calculatingMachine readable medium carries one or more program, when said one or multiple programs are executed by the device, so that shouldDevice: the JSON formatted data for describing target pages is obtained, wherein JSON formatted data includes included by target pagesComponent type, component type value, the component type of component are worth the attribute and attribute value of corresponding component;According to component type value,Component is searched in preset assembly set as target element, wherein the component in assembly set is registered in advanceComponent;It is worth the attribute and attribute value of corresponding component according to component type, updates the respective attributes and attribute value of target element;BaseIn updated target element, target pages are generated.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.Those skilled in the artMember is it should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristicScheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent featureAny combination and the other technical solutions formed.Such as features described above has similar function with (but being not limited to) disclosed hereinCan technical characteristic replaced mutually and the technical solution that is formed.