Open GoogleCodeExporter opened 9 years ago
What steps will reproduce the problem? 1.I don't know the method of how to pass json data from action class to jstree ajax calling script 2. 3. What is the expected output? What do you see instead? What version of the product are you using? On what browser? Please provide any additional information below. my code in jsp is $("#treemenu1").jstree({ "json_data" : { //"data" : "<li class='jstree-closed' id='root2'><a href='#'>Root node</a></li>" //"ajax" : { "url" : "http://localhost:8080/ata/ajax.do"} //'data' :[ {'data' : 'Search engines'},{'data' : 'Networking sites'}], "ajax" : {"url" : "http://localhost:8080/ata/ajax.do”} }, "plugins" : [ "themes","json_data"] }); package com.tmme.ata.web; import java.awt.Window; import java.io.IOException; import java.util.HashMap; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sf.json.JSONObject; import org.apache.log4j.Logger; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; public class AjaxAction extends Action{ private static Logger logger = Logger.getLogger(AjaxAction.class); public final ActionForward execute(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println("in ajax"); // String str = "<ul><li class="+"[ jstree-open | jstree-closed ]"+"><a href="+"some_value_here"+">Node title</a></li></ul>"; //String str ="{'data' : 'Search engines'},{'data' : 'Networking sites'}"; String str = "'data' :[ {'data' : 'Search engines'},{'data' : 'Networking sites'}]"; //String str ="hi"; //HashMap hm = new HashMap(); //hm.put("treemenu1",str); response.getOutputStream().print(str); //JSONObject json = JSONObject.fromObject(str); //System.out.println("Responce"+json.toString()); response.setHeader("X-JSON", str); return null; } }
Original issue reported on code.google.com by soham.ba...@gmail.com on 4 Jan 2012 at 12:00
soham.ba...@gmail.com
Original issue reported on code.google.com by
soham.ba...@gmail.com
on 4 Jan 2012 at 12:00