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 be using the application for accessing the method for enumerating data or for accessing the dress for enumerating dataThe exemplary system architecture 100 for the embodiment set.
As shown in Figure 1, system architecture 100 may include terminal device 101,102,103, first server 104, second is takenBusiness device 105 and network 106, network 107.Network 106 is between terminal device 101,102,103 and first server 104The medium of communication link is provided.Network 107 is to provide communication link between first server 104 and second server 105Medium.Network 106 and network 107 may include various connection types, such as wired, wireless communication link or fiber optic cablesEtc..
User can be used terminal device 101,102,103 and be interacted by network 106 with first server 104, to receiveOr send message etc..Various telecommunication customer end applications can be installed, such as shopping class is answered on terminal device 101,102,103With, searching class application etc..
Terminal device 101,102,103 can be the various electronic equipments with display screen and supported web page browsing, packetInclude but be not limited to smart phone, tablet computer, E-book reader, MP3 player (Moving Picture ExpertsGroup Audio Layer III, dynamic image expert's compression standard audio level 3), MP4 (Moving PictureExperts Group Audio Layer IV, dynamic image expert's compression standard audio level 4) it is player, on knee portableComputer and desktop computer etc..
First server 104 can be to provide the server of various services, such as show on terminal device 101,102,103The Web application shown provides the background server of user interface.First server 104 can receive user and be sent by terminal deviceAccessing page request, the method and data for including to 105 invoking page of second server by network 107;Receive the second clothesThe data for the method operation result that device 105 returns and the above-mentioned calling of being engaged in.The result that first server 104 runs the above methodUser interface is constructed according to indicating template with data, and above-mentioned user interface is returned into above-mentioned terminal device 101,102,103.
Second server 105 can be to provide the background server of various services, such as receive first server 104 to settingThe call request for setting the method or data on second server 105 runs the method for calling and by the operation knot to methodFruit is sent to first server 104 by network 107, or the data of calling are sent to first server by network 107104.In some embodiments, second server can also be connect by network with multiple databases, and second server passes through theCall request of one server to method or data obtains the above method and data from above-mentioned multiple databases.
In application scenes, above-mentioned first server and second server can also be same physical equipment.
It should be noted that for accessing the method for enumerating data generally by first service provided by the embodiment of the present applicationDevice 104 executes, and correspondingly, enumerates the devices of data for accessing and is generally positioned in first server 104.
It should be understood that the terminal device, network and first server and the number of second server in Fig. 1 are only to illustrateProperty.According to needs are realized, any number of terminal device, network and first server and second server can have.
With continued reference to Fig. 2, the stream of one embodiment for accessing the method for enumerating data according to the application is shownJourney 200.This is for accessing the method for enumerating data, comprising the following steps:
Step 201, user is received to the access request of the page of application.
In the present embodiment, it is (such as shown in FIG. 1 to run electronic equipment thereon for the method for enumerating data accessFirst server 104) page browsing can be carried out using it from user by wired connection mode or radio connectionTerminal device (such as terminal device shown in FIG. 1 101,102,103) receives the access request of the page of application.Wherein, above-mentionedUsing that can be a Web application, the above-mentioned page can be a page of above-mentioned Web application.Specifically, user can be firstThe Web application of installation on the terminal device is opened, and then selects to access any one page of Web application.Wherein, at thisIt may include multiple enumerating item in the page of Web application.
In application scenes, above-mentioned item of enumerating be can be under one be presented on the page that booking class Web is appliedDraw frame, such as " passenger type " combobox etc..
It should be pointed out that above-mentioned radio connection can include but is not limited to 3G/4G connection, WiFi connection, bluetoothConnection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection and other currently known or exploitations in the futureRadio connection.
In general, user can use terminal to browse each page of above-mentioned Web application.In the present embodiment, above-mentioned WebThe page may include html format, xhtml format, asp format, php format, jsp format, shtml format, nsp format, xmlAt least one of format etc..
In application scenes, the access request of the above-mentioned page may include the network address that user it is expected the page of browsing.
Step 202, multiple enumerate is called each in item described to enumerate that item is corresponding to enumerate class according to access request.
In the present embodiment, above-mentioned Web application may include multiple pages.It may include multiple enumerate in each page?.
Wherein, it is each enumerate item and can correspond to multiple enumerate data.In addition, any one, which enumerates item, can correspond to backstage branchIt holds one in the application program of the page and enumerates class.It is above-mentioned enumerate item it is corresponding any one enumerate data and can be this and enumerateCorresponding enumerate in class the enumeration element of item.Above-mentioned class of enumerating can be stored in second server.That is, secondIt can be saved in server and multiple enumerate class.
It, can be by the Web using corresponding when starting the code of the above-mentioned Web application of operation support in second serverClass is enumerated to be loaded into memory.In this way, when above-mentioned electronic equipment to Web using it is corresponding some enumerate class and be called when,This can be directly searched from memory and enumerates class, so that the above-mentioned electronic equipment of quick response enumerates this calling of class.
In application scenes, each enumerates the corresponding alias of class.The alias that difference enumerates class is not identical.In this wayStarting runs above-mentioned Web in application, above-mentioned each alias for enumerating class can be loaded into memory in second server, withIt is called for above-mentioned electronic equipment.When above-mentioned electronic equipment calls corresponding when enumerating class of certain alias, above-mentioned second server rootThe sequential value for enumerating the corresponding each enumeration element of class is taken out according to above-mentioned alias.It is loaded in the memory of second server eachThe alias for enumerating class can enumerate class according to the above-mentioned alias calling for enumerating class when above-mentioned electronic equipment is called.In this waySecond server memory usage can be saved, so that second server response speed with higher.
After above-mentioned electronic equipment receives the access request of the page in step 201, it can determine that the page is wrappedWhat is included each enumerates item.Then it determines each to enumerate that item is corresponding to enumerate class.
When judge respectively to enumerate item is corresponding to enumerate class after, can call the page is corresponding to enumerate that item is corresponding, setsIt sets and each in second server enumerates class.
In application scenes, can be set that the above-mentioned page includes in above-mentioned electronic equipment each to enumerate item correspondingEach interface for enumerating class.By above-mentioned interface, calls in above-mentioned second server and enumerate class.
Step 203, it receives and enumerates data to what calling enumerated that the return value of class parses according to pre-defined rule and show.
In the present embodiment, it is preserved in above-mentioned second server and each to enumerate sequential value included by class correspondingEnumerate data.For any one is enumerated, this, which enumerates any one sequential value in class, can enumerate data pass with oneUNPROFOR is deposited.In the present embodiment, above-mentioned data of enumerating can be numerical value, character etc., and wherein character may include English characterAnd Chinese character.
In the present embodiment, above-mentioned second server with according to above-mentioned incidence relation parse this enumerate it is each included by classA sequential value is corresponding to enumerate data.
In some embodiments, above-mentioned pre-defined rule may include the sequence model for enumerating data for the display that user specifiesIt encloses.When user to above-mentioned electronic equipment send accessing page request when, can be selected in the page and need in access requestThe sequential value of display is corresponding to enumerate data.In this way, second server can according to enumerate the sequential value that data are enumerated in class comeParsing user needs the sequence context is corresponding each to enumerate data.
In some embodiments, if user does not know that the range of data is enumerated in display, above-mentioned pre-defined rule can beAny one is enumerated and respectively enumerates sequential value parsing in class and respectively associated enumerates data.
In some embodiments, item is enumerated for each, this can be set and enumerates the corresponding attribute for enumerating class of item.AndTo attribute assignment.Such as attribute value, when being " 0 ", representative does not show and enumerates data, when attribute value is " 1 ", represents display enumeratorAccording to.Above-mentioned electronic equipment send to above-mentioned second server call respectively enumerate that item is corresponding to enumerate class when, can be by above-mentioned pieceThe attribute value for lifting class is sent to above-mentioned second server simultaneously.Second server can judge whether to parse according to above-mentioned attribute valueThis is called to enumerate class return value.
Second server will respectively be enumerated the corresponding return value for enumerating class of item to calling according to pre-defined rule and be parsedTo data of enumerating above-mentioned electronic equipment is sent to by network.
Above-mentioned electronic equipment receive it is above-mentioned enumerates data, and construct this and enumerate each of item and enumerate the corresponding view of data.It namely shows and above-mentioned respectively enumerates data.
Further, above-mentioned electronic equipment sends subscriber terminal equipment (such as Fig. 1 for above-mentioned displaying result by networkShown in subscriber terminal equipment 101,102,103).
Method provided in this embodiment for enumerating data access, passes through the access request according to user to the page, rootAccording to access request enumerating of calling that the page includes, item is corresponding to enumerate class, then receives and shows pre-defined rule to calling each instituteState enumerate that the corresponding return value for enumerating class of item parses enumerate data, to realize that Web application front end enumerates itemIt is updated as the update of class is enumerated in rear end, has saved and enumerated the synchronous institute of category code using rear end in Web application front end and WebThe cost of the exploitation and maintenance that need.In addition, enumerating data using above method access, it can to enumerate class as a componentIt is applied in each page by developer, convenient for extending the use scope for enumerating class.
Continue ginseng and open Fig. 3, Fig. 3 is a signal of the application scenarios of the method for enumerating data access of the present embodimentFigure.In the application scenarios 300 of Fig. 3, above-mentioned electronic equipment 302 receives the accessing page request of application from user terminal 301303.What above-mentioned electronic equipment 302 called that the above-mentioned page in second server 304 includes enumerate, and item is corresponding to enumerate class 305.The corresponding multiple classes of enumerating of above-mentioned application can be loaded onto memory in advance in above-mentioned second server 304.Above-mentioned second clothesBusiness device 304 receive above-mentioned electronic equipment to the above-mentioned call request 305 for enumerating class after, can be searched from memory above-mentionedThe page is corresponding each to enumerate class 306.Obtain above-mentioned each return value 307 for enumerating class.By above-mentioned each return for enumerating classValue parses to obtain according to pre-defined rule each enumerates that class is corresponding to enumerate data 308.It is finally sent to above-mentioned electronic equipment above-mentionedIt is each to enumerate that class is corresponding to enumerate data 309.Above-mentioned electronic equipment 302, which receives, above-mentioned enumerates data and to above-mentioned terminal device exhibitionShow 310.
Method provided in this embodiment is added according to access request from advance by receiving user to the access request of the pageCarry it is multiple enumerate to search in class enumerate that item is corresponding to enumerate class with multiple included by the above-mentioned page, sequentially for page correspondenceIt is multiple enumerate each of class enumerate class according to preset rules parse this enumerate class it is corresponding it is multiple enumerate data, and will solutionThe data of enumerating being precipitated are sent to front end so that front end, which is shown, enumerates data, to realize the rear end in Web application to enumeratingIn class when enumerating data and modifying and add, do not need to enumerate class the corresponding modification in front end is above-mentioned, to can both saveThe time of Web application code maintenance, the maintainability of Web application code can also be increased.
In some optional implementations of the present embodiment, Model View Controller can be set in above-mentioned electronic equipment(Model-View-Controller, MVC).Above-mentioned electronic equipment can be by involved by Model View Controller and the offer pageAnd method and the servers (such as second server shown in FIG. 1) of data interact.It can also in above-mentioned second serverModel View Controller is arranged.Above-mentioned electronic equipment can be by the Model View Controller that is arranged in above-mentioned electronic equipmentTo judge respectively to enumerate, item is corresponding enumerates class.And piece being arranged in second server is called by above-mentioned Model View ControllerLift class.It specifically, may include multiple interfaces for enumerating class in above-mentioned Model View Controller, Model View Controller is according to pageThe interface calling for class that face was related to enumerate enumerates class.
In some optional implementations of the present embodiment, above-mentioned Model View Controller can be exchanged according to what is receivedEnumerate the return value of class be resolved to enumerate data, building enumerates the relevant view of data to this.Above-mentioned electronic equipmentIt can show the view, and the view is sent to the terminal device of user.
In some optional implementations of the present embodiment, class is enumerated for each, is respectively provided in above-mentioned electronic equipmentThere is this to enumerate the note of class.The note that class is enumerated for each can set the application of the note in the statement of the noteRange.Above-mentioned electronic equipment can be searched and above-mentioned page by each note for enumerating class from pre-loaded multiple enumerate in classIncluded by face it is multiple enumerate in item each enumerate that item is corresponding to enumerate class.
In some optional implementations of the present embodiment, corresponds to any one and enumerate class, above-mentioned electronic equipment can lead toIt crosses above-mentioned view controller and using loop iteration method parses this and enumerate class and correspond to and multiple enumerate data.Specifically, above-mentioned electricitySub- equipment can pass through view controller
In some optional implementations of the present embodiment, in step 203, loop iteration method can be used and parseThis enumerates that class is corresponding multiple to enumerate data.
In some optional implementations of the present embodiment, above-mentioned electronic equipment can pass through model according to access requestView controller is called each before enumerating that item is corresponding and enumerating class, registers and binds each in Model View ControllerIt enumerates item and each enumerates that item is corresponding to enumerate class.In this way, being asked when above-mentioned electronic equipment receives user to the access of the pageWhen asking, the Model View Controller that is arranged in above-mentioned electronic equipment is searched to be enumerated with what each in the page enumerated that item bindsClass.And this is called to enumerate class by the interface for enumerating class.
With further reference to Fig. 4, as the realization to method shown in above-mentioned each figure, this application provides one kind to be used for enumeratorAccording to one embodiment of the device of access, the Installation practice is corresponding with embodiment of the method shown in Fig. 2, which specifically may be usedTo be applied in various electronic equipments.
As shown in figure 4, the device 400 for enumerating data access of the present embodiment includes: the first receiving unit 401, adjustsWith unit 402 and the second receiving unit 403.Wherein, the first receiving unit 401 is configured to receive user to the page of applicationAccess request, wherein the page includes multiple enumerating item;Call unit 402 is configured to be regarded according to access request by modelFigure controller calls multiple enumerate respectively to enumerate that item is corresponding to enumerate class in item;Second receiving unit 403, is configured to receiveIt enumerates data to what calling respectively enumerated that the corresponding return value for enumerating class of item parses according to pre-defined rule and shows.
In the present embodiment, for enumerating the first receiving unit 401,402 and of call unit of the device 400 of data accessThe specific processing of second receiving unit 403 and its brought technical effect can be respectively with reference to steps in Fig. 2 corresponding embodiment201, step 202, the related description of step 203, details are not described herein.
In some optional implementations of the present embodiment, above-mentioned call unit 402 is further configured to: passing through modelView controller enumerates class respective explain from multiple enumerate and screens that page-out is corresponding multiple to enumerate class simultaneously in class according to multipleIt calls.
In some optional implementations of the present embodiment, above-mentioned second receiving unit is further configured to for anyOne is enumerated class, receives that the return value for enumerating class corresponding multiple enumerates data by using loop iteration method parsesAnd it shows.
In some optional implementations of the present embodiment, the device 400 for enumerating data access further includes that binding is singleFirst (not shown).Above-mentioned binding unit, which is configured to call in above-mentioned call unit, passes through model view according to access requestController call it is multiple enumerate respectively enumerate that item is corresponding in item and enumerate class before, register and tie up in Model View ControllerIt is fixed respectively to enumerate that item is corresponding to enumerate class.
Referring to FIG. 5, it illustrates the structural representations of the computer system 500 for the electronic equipment for being applicable in the embodiment of the present applicationFigure.
As shown in figure 5, computer system 500 includes central processing unit (CPU) 501, it can be read-only according to being stored inProgram in memory (ROM) 502 or be loaded into the program in random access storage device (RAM) 503 from storage section 508 andExecute various movements appropriate and processing.In RAM 503, also it is stored with system 500 and operates required various programs and data.CPU501, ROM 502 and RAM 503 is connected with each other by bus 504.Input/output (I/O) interface 505 is also connected to alwaysLine 504.
I/O interface 505 is connected to lower component: the importation 506 including keyboard, mouse etc.;Including such as liquid crystalShow the output par, c 507 of device (LCD) and loudspeaker etc.;Storage section 508 including hard disk etc.;And including such as LAN card,The communications portion 509 of the network interface card of modem etc..Communications portion 509 executes communication via the network of such as internetProcessing.Driver 510 is also connected to I/O interface 505 as needed.Detachable media 511, such as disk, CD, magneto-optic disk,Semiconductor memory etc. is mounted on as needed on driver 510, in order to from the computer program read thereon according to needIt is mounted into storage section 508.
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 509, and/or from detachable media511 are mounted.When the computer program is executed by central processing unit (CPU) 501, 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 calculatingMachine readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but it is unlimitedIn system, server or the device of --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, or any above combination.MeterThe more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, just of one or more conducting wiresTaking formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only storageDevice (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device,Or above-mentioned any appropriate combination.In this application, computer readable storage medium can be it is any include or storage journeyThe tangible medium of sequence, the program can be commanded execution system, server or device use or overdue combined use.AndIn the application, computer-readable signal media may include in a base band or the data as the propagation of carrier wave a part are believedNumber, wherein carrying computer-readable program code.The data-signal of this propagation can take various forms, including but notIt is limited to electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be computerAny computer-readable medium other than readable storage medium storing program for executing, the computer-readable medium can send, propagate or transmit useIn the program by the use of instruction execution system, server or device or overdue combined use.It is wrapped on computer-readable mediumThe program code contained can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc., orAbove-mentioned any appropriate combination.
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 the first receiving unit, call unit and the second receiving unit.Wherein, the title of these units not structure under certain conditionsThe restriction of the pairs of unit itself, for example, the first receiving unit is also described as " receiving visit of the user to the page of applicationAsk the unit of request ".
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: receiving user to the access request of the page of application, and wherein the page includes multiple enumerating item;Pass through mould according to access requestType view controller calls multiple enumerate respectively to enumerate that item is corresponding to enumerate class in item;It receives each to calling according to pre-defined ruleThat enumerates that the corresponding return value for enumerating class of item parses enumerates data and shows.
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 the inventive concept, 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.