Webpage seamless combination processing method based on FLEX and JSP
Technical field
The present invention relates at a kind of web page processing method, more particularly to a kind of webpage seamless combination based on FLEX and JSP
Reason method.
Background technology
With the development of rich client RIA, traditional C/S structures and the system of B/S mechanical developments is all difficult to unilaterally
Meet the day by day brand-new demand of user, the loaded down with trivial details of C/S structures installation should be avoided, also to avoid B/S structure disperses and disunity,
Reach and experienced using desktop software as C/S structures, B/S structures are reached again exempts from install convenient.In simple terms, existing several knots
Structure feature is as follows:
(Client/Server (client/server) structure is known software system system knot to C/S structures
Structure, by the way that task is reasonably allocated to into Client ends and Server ends, reduces the communication-cost of system, needs to install client
Operation can be just managed.
B/S structures(Browser/Server, Browser/Server Mode), it is a kind of network structure mould after WEB rises
Formula, web browser is the topmost application software of client.
Rich client(Rich Internet application program Rich Internet Applications, RIA)Using with very strong
Providing the user a higher and more omnibearing network experience, Rich Client are one to the Rich Client Technology of interactivity
Individual relative concept, is primarily directed to application at present widely based on WEB, because this client(Namely it is existing various
Browser)Running environment one good component model is not provided and interaction models cause this application interface same clothes
It is extremely odd that interaction between business becomes, and interaction each time is required for reorganizing out whole interface, and the tissue base at this interface
This is completed in server end, also so the logic for causing presentation layer occupy server end, so this is called Thin Client,
And relative is then Rich Client, even technically Rich Client also neither ones are two big unification at present
And and the standard technique of maturation out, so Rich Client can only say it is a kind of framework mode, its feature is that service is same
Completely physical separation is showed, performance logic is responsible for completely by client, and this is the most important point.But must be simultaneously simultaneous
The features such as zero deployment of Gu Yuanyou WEB applications.
In transition from C/S structure to rich client, by the installation of C/S structures at the beginning is loaded down with trivial details but efficiency high;To B/S knots
The exempting from of structure is installed, using simple but inefficiency;Need again to be obtained not with reference to the above two advantage but poor compatibility to rich client
To solution.
The technical method major part of existing B/S structures is all that simple technical language combination reaches same system.Such as
HTML set HTML, JSP set JSP, webpage set FLEX, but click on every time any function all can waiting for server response and cause whole page
Face or local page are reloaded, if network speed is unstable or server will appear from white screen etc. and cannot continue prior operation etc. asking without response
Topic.
1)Server response length
Each function needs access server wait-for-response back and forth, server to receive the establishment client after request from top to bottom
End interface, without the order of predicted events.Each component is simultaneously dependent, and because of a request the whole view of impact is made
Reaction.
2)Function overlapping development
Different WEB language sacrifice one of which to accomplish to have in identical platform system, again by unified WEB language
Exploitation once just can be integrated together.
3)Poor compatibility
The different WEB language developments pages are difficult to communicate each other, it is difficult to mutual calling function and shared page resource.
4)The page is excessive
It is very chaotic in order to operate difference in functionality to need to open multiple labels pages on a web browser simultaneously;For not supporting
Multi-tag browser can be more chaotic.
Therefore, it is necessary to provide a kind of webpage seamless combination processing method based on FLEX and JSP, either at present which
Kind of web language can seamless combination to the rich client system of B/S structures in, can solve the problem that between different language with reference to and tune
Incompatibility problem and function restriction problem, the product for developing allows user really to possess the native client of C/S structures
End experience.
The content of the invention
The technical problem to be solved is to provide a kind of webpage seamless combination process side based on FLEX and JSP
Method, had both been avoided that C/S structures were installed loaded down with trivial details, and B/S structure disperses and disunity are avoided that again, and compatible any WEB language is write
The page, and can reach and experienced using desktop software as C/S structures.
The technical scheme that the present invention is adopted to solve above-mentioned technical problem is to provide a kind of webpage based on FLEX and JSP
Seamless combination processing method, including main page and multiple nested sub-pages, wherein, comprise the steps:A) institute is generated using JSP
Main page is stated, the main page carries out data interaction with service end using synchronization process mode;B) it is described by FLEX unified managements
Multiple nested sub-pages, the interaction data that the FLEX monitorings main page is obtained from service end is simultaneously distributed to corresponding nesting subnet
Page;C) each nested sub-pages carries out independent refreshing and shows and keep current operation status.
The above-mentioned webpage seamless combination processing method based on FLEX and JSP, wherein, the main page and multiple nested sub
The shared root file of webpage, passes through calling interface function passes parameter between the main page and multiple nested sub-pages.
The above-mentioned webpage seamless combination processing method based on FLEX and JSP, wherein, the plurality of nested sub-pages it is upper
Hereafter root be directed to the root of main page, the plurality of nested sub-pages and main page root have it is same
Security sandbox configuration file.
The above-mentioned webpage seamless combination processing method based on FLEX and JSP, wherein, the main page receives service end
Data after be stored in the variable for pre-defining, the FLEX listens to main page to be had after new data, obtain new data deposit
The variable for entering FLEX and emptying main page reduces EMS memory occupation.
The above-mentioned webpage seamless combination processing method based on FLEX and JSP, wherein, the FLEX enters to fetched data
Row analysis, if the listing information data in a certain nested sub-pages updates, then transmits listing information data and gives nesting
Webpage carries out refreshing and shows.
The above-mentioned webpage seamless combination processing method based on FLEX and JSP, wherein, the plurality of nested sub-pages are adopted
Prestrain mode is shown.
The above-mentioned webpage seamless combination processing method based on FLEX and JSP, wherein, the plurality of nested sub-pages by
HTML, ASPX, FLASH, PHP or JSP are generated.
Present invention contrast prior art has following beneficial effect:The webpage based on FLEX and JSP that the present invention is provided without
Seam combines processing method, generates the main page by JSP and synchronizes data interaction with service end, is managed collectively by FLEX many
Individual nested sub-pages realize asynchronous data transaction so that each nested sub-pages carries out independent refreshing and shows and keep current behaviour
Make state, so as to both be avoided that it is loaded down with trivial details that C/S structures are installed, B/S structure disperses and disunity, compatible any WEB are avoided that again
The page that language is write, and can reach and experienced using desktop software as C/S structures.
Description of the drawings
Fig. 1 is the present invention based on FLEX schematic diagrams nested with the webpage of JSP;
Fig. 2 is webpage seamless combination handling process schematic diagram of the present invention based on FLEX and JSP;
Fig. 3 is webpage and server data interaction schematic diagram of the present invention based on FLEX and JSP.
Specific embodiment
With reference to the accompanying drawings and examples the invention will be further described.
Fig. 1 is the present invention based on FLEX schematic diagrams nested with the webpage of JSP;Fig. 2 is net of the present invention based on FLEX and JSP
Page seamless combination handling process schematic diagram.
Fig. 1 and Fig. 2 is referred to, the webpage seamless combination processing method based on FLEX and JSP that the present invention is provided includes master
The shared root file of webpage and multiple nested sub-pages, the main page and multiple nested sub-pages, the main page and many
Calling interface function passes parameter can be passed through between individual nested sub-pages, wherein, comprise the steps:
Step S1:The main page is generated using JSP, the main page enters line number with service end using synchronization process mode
According to interaction.
Step S2:The plurality of nested sub-pages are generated by HTML, ASPX, FLASH, PHP or JSP.Managed by FLEX unifications
The plurality of nested sub-pages are managed, the interaction data that the FLEX monitorings main page is obtained from service end is simultaneously distributed to corresponding embedding
Set sub-pages;The context root of the plurality of nested sub-pages is directed to the root of main page, the plurality of nested son
The root of webpage and main page has same security sandbox configuration file.
Step S3:Each nested sub-pages carries out independent refreshing and shows and keep current operation status.The main page
During the variable for pre-defining is stored to after the data for receiving service end, the FLEX listens to main page to be had after new data,
Obtain new data to deposit into FLEX and empty the variable reduction EMS memory occupation of main page.The FLEX is carried out point to fetched data
Analysis, if the listing information data in a certain nested sub-pages updates, then transmits listing information data to the nested sub-pages
Carry out refreshing to show.
The operation principle of the present invention is as follows:Integrate carry out in each separate function, the page, system to platform it is seamless
The entirety of a complementation is combined into, each layer function page carries out intelligent prestrain, imperceptible traditional B/S when making user operation
System is often clicked on after One function will wait respond for many seconds and just can operated, just as operating local client software.
The present invention is developed using two open source technology, is respectively FLEX and JSP, because two can be at all PC ends
With perfect operation on any a browser of most of mobile terminal, thus seamless combination is carried out again on FLEX and JSP platforms each
Plant function webpage or rich client application.After the mutually complementary combinations of FLEX and JSP, FLEX runs in B/S structures and has part
The function of being related to file process is limited(Read functions are not included), but JSP does not have this restriction.
For example, a pictures or a file are uploaded to server, FLEX can only accomplish to browse user's local file
Binary stream is construed to, but is limited and is communicated to server, at this time unrestricted JSP can be this section of binary stream transfer
Realize files passe function to server because FLEX be easy to make very friendly interface and under various browsers not
Deformation, the interface that JSP does is more stiff, and plus pattern beautification, part format can all occurs per money browser display
Do not support, deform, walk wait at present can not solve problem, so the operation of FLEX comprehensive user orienteds, JSP as data relay with
Data distributing, had not only reached that interface is friendly attractive in appearance but also need not worry about user with which kind of browser or version, and JSP can be ensured again
Information Security.
But only it is combined together not enough, in order to reduce exploitation amount, two kinds of technological development personnel of FLEX and JSP are not
, to create a kind of seamless associated methods makes FLEX and JSP become the framework core of project, and to Project Product many technologies are carried out
Extend exploitation and support is provided.
The webpage seamless combination processing method based on FLEX and JSP that the present invention is provided, by B/S structural systems richness is transformed into
Client substantially reduces the secondary development amount of existing and difference WEB language development functions;For first development system can be reduced
Coupling, different team are by seamless combination after codes and standards stand-alone development on this technology platform.
This seamless combination technology is by the design of application program from being transferred to centered on the page relatively independent one by one
Transformation centered on component will be such that the design of client layer is lifted to a new level, and client layer can be made to become more
Flexibly.Rich client layer no longer becomes the most terminal of server response, and this is also improved the performance of program simultaneously, and user uses
Feel to just look like that program need not be communicated with server or is just to need to be communicated once in a while.
Prior art gets used to a large amount of third party's instruments and goes to bridge the middleware of FLEX and background communication, such as
BlazeDS technologies directly access background java realizing FLEX, be in addition B/S systems just only with B/S structures thinking exploitation, so
Become FLEX and unilaterally transfer background java, and JAVA cannot go to have transferred the situation of FLEX, AM/BAM is interactive to become unidirectional,
A large amount of third party's tool racks cause hydraulic performance decline to have limitation middle, need to grasp one or two gate technique developer more and just realize
Same effect.
Unlike traditional model, server of the present invention receives the establishment client end interface after request from top to bottom, this
Invention without predicted events order.Since each component is independent, it is not necessary to because one is asked and makes shadow
Ring the reaction of full page view.Make each component that there is the ability for transmitting information to server to need each component to know
The how information of processing server be passed back.In the WEB application of this seamless combination method exploitation, client layer and server layer
Interaction data is asynchronous, thus can create the response that information is sent to server and processing server with control assembly, can
More scattered control decoupling is thought with separable programming function and set up service-oriented program structure, as shown in Figure 3.
The request of server is responded in the platform of seamless combination be all independent, because combining pre-loaded function, often
One function can be rested on during user operation before browser is closed, it is not necessary to which it is next again that user synchronously completes something
Part thing, can go to use systemic-function with asynchronous, such as when function one fills in a form half, gone to draw a diagram, and later fill in a form again
Function pages or dependence reading database data need not be reloaded to regenerate.
The scheme that one embodiment is given below realizes flow process:
Step 1, with the newly-built FLEX projects of Flash Builder;
Step 2, with the newly-built JAVA WEB projects of eclipse;
Step 3, FLEX engineerings are configured to JAVA, and context root points to JAVA WEB catalogues(Send out for FLEX codes
The SWF file paths that cloth is generated);
A security sandbox configuration file crossdomain.xml is write in step 4, JAVA WEB roots(For not
Use with WEB catalogue exchanging visit files), while also crossdomain.xml files are placed on to introduce other WEB roots of the page
In catalogue;
Step 5, write a JSP;
Step 6, the Application for writing a FLEX;
Step 7, startup WEB service, open the JSP on browser, at this moment put up the simple combination of JSP and FLEX,
Method followed by seamless combination is realized;
Step 8, JSP write the SWF programs that FLEX engineerings are generated that introduce, write interface function give FLEX call access with
And Transfer Parameters;
Step 9, the JSP to introducing itself write oracle listener, and for obtaining server in real time data or JSP are issued
Data message is issued, the function that JSP is provided is conducted interviews and Transfer Parameters;
Step 10, the mutual required function interfaces of FLEX and this JSP are write as FLEX and JSP seamless combinations in project
Support engine;
Step 11, in a browser access JSP when, server issues data and gets off, and needs dynamic load other functions page
When face is to each diverse location, is received by JSP and data are stored in the variable for defining, FLEX is write by ' step 9 '
Oracle listener perceive JSP have new data, to new data obtain deposit into FLEX and empty JSP variable reduce EMS memory occupation.
FLEX is analyzed to fetched data, is that listing information data updates, or is introduced by safety by FLEX loadings
The JSP function pages of one specified address of the WEB catalogues of sandbox configuration are displayed in specified location, or to some function moneys
Source or JSP carry out prestrain, experience as JSP introduces JSP, and FLEX introduces FLEX and equally merges harmony, is not in
The problems such as incompatible or function is unable to intermodulation on 2 kinds of technological frames.When user realizes certain work(in FLEX click function buttons
The characteristics of FLEX is asynchronous during energy meeting quick response user operation, operates the data realized to go to backstage to JSP by interface function
Process, and FLEX is blocked all without the process as other webpages and is not carried out the next item down user operation till JSP returning results,
All in the case where user operation current page is not affected, the asynchronous process of FLEX is interacted with the synchronization process seamless combination of JSP for everything
Under complete, make Consumer's Experience the same in the machine C/S structure.
The webpage seamless combination processing method based on FLEX and JSP that the present invention is provided, with following technical characterstic:1)Across
Platform is across development language:Different language page invocation is called in realization, adapts to various platform browser operations.2)Compatibility is good:It is right
The different WEB systems pages can be come in and be run using the method seamless combination compatibility, there is currently no WEB page not supported
Face.3)Using simple:Only needing to the URL for setting to pass to the method as parameter just can realize.4)Component concept:Will
The method is encapsulated into component, facilitates the recycling of different system.5)Authorize:The seamless combination method is a kind of guiding skill
Art method, easily authorizes.Concrete advantage is as follows:1st, set for this platform by FLEX and JSP seamless combination technologies, realized integrated identical
Or the WEB page and system of different language;2nd, specification FLEX interface and JSP interfaces realize each system page in language and platform
Access and call;3rd, prestrain current page feature content, shows feature content quick response;4th, in design to affairs and
The degree of freedom of other resources is high, allows the developer of two kinds of technologies to be more absorbed in exploitation FLEX or JSP.
Although the present invention is disclosed as above with preferred embodiment, so it is not limited to the present invention, any this area skill
Art personnel, without departing from the spirit and scope of the present invention, when a little modification and perfect, therefore the protection model of the present invention can be made
Enclose when by being defined that claims are defined.