Today, someone asked me about the issue of XMLHTTP on MSN and asked me about the combination of XMLHTTP and servlet. I told him directly that I use XMLRPC or HESSIAN.
For XMLHTTP, I found a lot of people who don't understand it think it is very mysterious. The Dlee written on Javaeye claims that XMLHTTP does not have to have MVC, etc. "complex" mode, and it is even possible to apply the three layers of the web to two. In my opinion, XMLHTTP introduces, but, it is improving the user interface, and the thing that needs to be refreshed does not need to refresh. This requirement is not common in the previous Web program, but in modern applications, with the rise of RIA, the user experience has become important, for example: page brushless refresh (typical tree structure ), Or topical refresh of the page. XMLHTTP capable of completing this feature is of course important.
Is XMLHTTP a technology? I have never think so. Whether in the Mozilla browser, still in IE, his method / attribute is then: Open, send, onreadystatechage, responsext, responsexml ... This abstract thing, completed the original browser's request / accept data. This seems that XMLHTTP is just an accessory thread of the browser. You can use it to achieve a series of effects that you want to have no refresh, that is conditional:
This condition is that before and after the XMLHTTP, your code will not decrease, more cases are the increase in code. For simple applications, such as the user login, the server submits the username password, returns a true or false to represent the success of the login. After XMLHTTP, this login effect can be done very dazzling, and the code is almost the same as if there is no XMLHTTP. But for complex applications, such as list of big data, you have the following options to use XMLHTTP:
1 For lazy people, the easiest way is to generate the HTML generated in the server side (the
2 For those who like XML or like structured data, packaging the data into an XML node, then obtain XML with XMLHttp.Responsexml. Then there are two processing: In my opinion, the simplest handle is to write an XSL to resolve the acquired XML and then display, the most stupid method is of course, to parse the XML node tree, then process and display. Incidentally, I am doing an OLAP system to display the former method. Since the XML form of the analysis result of the OLAP system is fixed.
3 For commands based on commands, limited or simple rules, you can design a set of message formats yourself, "encoding -> send request between client and server) -> Decoding -> Processing -> Send Results game. This gameplay is the way I take in my LiveChat scene chat room. This is more troublesome about design message format and server-side encoding, decoding processing. If possible, it is recommended to use XMLRPC to be implemented.
There may be other way applications, I have not involved. However, no matter which way, we can see that these operations are just the front desk performance level. Is XMLHTTP a way to handle business logic, data access, permission control, etc.