|
|
::::::::::::::::::::::::::
|
|
:::::::::::::::::::::::::
|
|
|
|
Problems of use Ajax
As well as in many other technologies, in Ajax there is a set of ways to make mistakes. Some from problems which I discuss here, at present have successful and easy decisions, but can be improved as Ajax-products. As the community of developers gives experience in development of Ajax-applications, the best of practice and directories will be written down.
Advantage{Benefit} XMLHttpRequest
One of the important problems{tasks} rising before the person of Ajax-developers, the question is how to answer, when XMLHttpRequest is inaccessible. While the majority of modern browsers support XMLHttpRequest, always there are users at whom XMLHttpRequest it is not supported or whose safety of a browser has not given to be executed XMLHttpRequest. If you develop the Web-application which is applicable{applied} in a corporate network, probably, you have advantage in definition, what browsers are supported and when XMLHttpRequest is always accessible. If you develop for a public network you should know, that, assuming, that XMLHttpRequest is accessible, you renounce users of older browsers, browsers of people with the closed access or superficial browsers with service against performance of your application.
Therefore it is necessary for you to try to make your application with " graceful deterioration " to remain functional even in browsers without support XMLHttpRequest. In an example of a basket of the buyer the best way to worsen the application - buttons Add to Cart, carrying out a usual role, updating page for the new status of a basket. With help Ajax it is possible to add in page through a JavaScript-code when the page is loaded, to attach operator JavaScript to each button Add to Cart if only it is accessible XMLHttpRequest. Other way - to define{determine} XMLHttpRequest when the user has come, and then to provide any Ajax the version of the application or the version based on usual forms if it is required.
Concerning functionality (usability)
Some from problems{tasks} of functionality in Ajax - it is enough the general{common}. For example, maybe, it is important to allow for users to learn{find out}, that their input is registered, as the usual feedback mechanism ("sand-glass" of the cursor and " a turning browser ") is not applicable for XMLHttpRequest. An output{exit} - to replace buttons To confirm with the message " It is updated … " that users did not press some times buttons pending search.
Other problem{task} will be, that users can not notice, that a part of page which they see, are already updated. You can solve this problem, using set visual tekhnik and receptions, for example, to draw an eye of the user to the updated places of page. Other problems{tasks} called by updating of page at Ajax, include the non-working button of returning back, incorrect display of the address or impossibility to add in favorites. Look section Resources for clauses{articles} which specialize on problems{tasks} of functionality in Ajax-applications.
Overload of the server
Performance of the Ajax-interface in a place where usual forms operate, can lead to to that the quantity{amount} of searches to the server will unexpectedly increase. For example, usual Google Web-search causes one search about the server when the user presses the button of search. However, Google Suggest which tries to finish automatically your action of search, sends some searches to the server while the user prints. When you develop the Ajax-application, remember, how much searches you will send the server, and whether there will be because of it an overload of the server. You can reduce an overload of the server, storing{keeping} searches about the party{side} of the client and hiding searches in the client if it is possible. You can also try to develop Ajax-applications so that the most part of action could be executed in a client part of your code without necessity of connection with the server.
Understanding with asinkhronnost`ju
It is very important to understand, that there is no guarantee, that XMLHttpRequest will end in that sequence in which they have been sent. Really, it is necessary for you to admit{allow}, that they will not return so, and to develop your application in view of this amendment. In an example of a basket of the buyer time of a mark of last updated product guaranteed earlier, that newer given baskets cannot be copied by older, (see listing 7). This underfulfilled approach works for the script of a basket of the buyer, but can not be carried out in other scripts.
In summary
You, should be, now well understand main principles of programming in Ajax and features a component of the server and the client which take place in Ajax. It is the base of the Ajax-application in language Java. In addition to said you should understand some development from problems{tasks} of higher abstract level which appear with techniques in Ajax. Creation of the successful Ajax-application will demand the general{common} approach, since development of interfaces with the help of a JavaScript-code and finishing{stopping} architecture of the server, but you now are armed with main principles of programming in Ajax, necessary for consideration of all these aspects.
It is very good, if you feel despondency because of complexity of a spelling of the big Ajax-applications with use of the receptions shown here. Such structures as Struts, Spring and Hibernate, develop, developing fine details Servlet API and JDBC, therefore appear means for simplification of Ajax-development. Some from them are focused exclusively on problems of the client party{side} of a code, finding easy ways for addition of visual effects to your pages or carefully analyzing use XMLHttpRequest. The some people go further, developing means for automatic generation of Ajax-interfaces on the part of the server. These structures perform heavy job for us, therefore you can concentrate on approaches of higher level. I rassmotrju some from them in this series.
Community Ajax quickly develops, here again there is a plenty of the important information. Before reading the following part of this series of clauses{articles}, I would recommend you to familiarize with clauses{articles} in section Resources, is especial if you are "newbie" in Ajax or in development of a client part of a code. Also you are required need time with an example of a code and to think of ways of his{its} improvement.
In following clause{article} of this series I rassmotrju XMLHttpRequest in more details also shall suggest ways of creation XML at once from yours JavaBeans. I also shall show you alternatives to XML for transfer of the Ajax-given, such as notation JSON.
XML-standards: results of last year
In clause{article} the question will be the results of activity of international consortia W3C most interesting, in our opinion, (World Wide Web Consortium) and OASIS [1] for 2006.

|