Recently, because the display speed of the Treeview control in Javascript form is too slow, I used Ajax + Yahoo UI to create a new one. After using Ajax for the first time, we finally implemented a lazy load-type classification tree. The server is a turbine action servlet that obtains the subnode information list based on the input node ID and returns the information in XML format. During the implementation process, we found that the servlet was still well written:
1. response. setcontenttype ("text/XML; charset = UTF-8") should be explicitly called to tell the client to return XML. If the settings are not enough in the generated XML template (I use the velocity template );
2. XML for client-to-server communication must be encoded in UTF-8 and the output stream of response must be set to UTF-8 encoding. If the GBK encoding client JavaScript calls Dom to process XML, a problem may occur;
Outputstreamwriter OSW = new outputstreamwriter (response. getoutputstream (), "UTF-8 ");
......