jquery ztree Asynchronous loading simple instance explanation _jquery

Source: Internet
Author: User

This article illustrates the jquery ztree asynchronous loading, shared for everyone to reference, the specific contents are as follows

The servlet configuration in Web.xml is as follows:

<?xml version= "1.0" encoding= "UTF-8"?> <web-app version= 
"2.4" xmlns= "http://java.sun.com/xml/ns/"  
  Java ee "  
  xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "  
  xsi:schemalocation=" http://java.sun.com/ XML/NS/J2EE  
  http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd "> 
   
   
  <servlet> 
    <servlet-name >getDataServlet</servlet-name>;  
    <servlet-class>testTree.TestTree</servlet-class>;  
  </servlet> 
   
  <servlet-mapping> 
  <servlet-name>getDataServlet</servlet-name>;  
  <url-pattern>/getData</url-pattern>;  
  </servlet-mapping> 
 

JSP page:

<! DOCTYPE html> <HTML> <HEAD> <TITLE> ztree demo-simple data</title> <meta Http-equi v= "Content-type" content= "text/html; Charset=utf-8 "> <link rel=" stylesheet "href=" Css/demo.css "type=" Text/css "> <link rel=" stylesheet "href= "Css/ztreestyle/ztreestyle.css" type= "Text/css" > <script type= "text/javascript" src= "Js/jquery-1.4.4.min.js" ></script> <script type= "Text/javascript" src= "Js/jquery.ztree.core-3.2.js" ></script> < Script type= "Text/javascript" src= "js/jquery.ztree.excheck-3.2.js" ></script> <script type= "text/" 
    JavaScript "src=" Js/jquery.ztree.exedit-3.2.js "></script> <script type=" Text/javascript "> <!-- 
        var setting = {data: {simpledata: {enable:true}}, Async: { Enable:true, url: "/testjquery/getdata", autoparam:["id", "name", otherparam:{"Otherpara M: "Ztreeasynctest"}, Datafilter:filter}}; 
      function filter (Treeid, ParentNode, childnodes) {if (!childnodes) return null; 
      For (var i=0, l=childnodes.length; i<l; i++) {childnodes[i].name = Childnodes[i].name.replace (', '); 
    return childnodes; 
      var znodes =[{id:1, pid:0, Name: "ParentNode 1", open:true}, {id:11, pid:1, Name: "ParentNode 11"}, {id:111, pid:11, Name: "Leafnode"}, {id:112, pid:11, Name: "Leafnode 112"}, {id:113, pid:11, Nam E: "Leafnode 113"}, {id:114, pid:11, Name: "Leafnode 114"}, {id:12, pid:1, Name: "ParentNode"}, {I d:121, Pid:12, Name: "Leafnode 121"}, {id:122, pid:12, Name: "Leafnode 122"}, {id:123, pid:12, Name: "Leafnod E 123 "}, {id:13, pid:1, Name:" ParentNode ", isparent:true}, {id:2, pid:0, Name:" ParentNode 2 ", Isparent: 
 
    true}]; $ (document). Ready (function () {$.fn.ztree.inIt ($ ("#treeDemo"), setting, znodes); 
    }); --> </SCRIPT> </HEAD> <BODY>  

 action code:

public class Testtree extends HttpServlet {@Override public void doget (HttpServletRequest request, Httpservletre 
    Sponse response) throws Servletexception, IOException {//System.out.println ("--------doget--------"); 
  This.dopost (request, response); @Override public void DoPost (HttpServletRequest request, httpservletresponse response) throws Servletexception, 
    IOException {//System.out.println ("--------doPost--------"); 
    String id = request.getparameter ("id"); 
    String name = Request.getparameter ("name"); 
    String level = Request.getparameter (' level '); 
    String Otherparam = Request.getparameter ("Otherparam"); 
     
    System.out.println (id + "|" + name + "|" + Level + "|" + Otherparam); 
    Jsonobject json = new Jsonobject (); 
     
    list 

The above is the jquery ztree asynchronous loading instance to share to everybody, hoped that everybody learns the asynchronous loading technology to be helpful.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.