Musachy Barroso schrieb:
On Tue, Dec 15, 2009 at 1:20 PM, Michael Obster <mich...@obster.org> wrote:
jsTree

I used it with the JSON plugin many moons ago, what problem are you having?


First of all I get no tree displayed. After looking into the generated JSON I see, that die variable names are quoted with "-quotes. Perhaps this confuses the jsTree. The second problem are escaped characters like "/" with are escaped as "\/" in the JSON.

I'm wrinting the generated JSON string into a string variable of a json-generating action class.

How do you create a JSON with that format:
[
  { attributes: { id : "pjson_1" },
                 data: "Root node 1",
  },
  { attributes: { id : "pjson_5" },
                 data: "Root node 2" }
 ]


I always getting s.th like this:
"myvariable" : [
  { "attributes": { "id" : "pjson_1" },
                 "data": "Root node 1",
  },
  { "attributes": { "id" : "pjson_5" },
                 "data": "Root node 2" }
 ]

The corresponding class looks like
public AjaxAction implements ActionSupport {

private String myvariable;

public String execute() throws Exception {
  JSTreeDataBuilder jsTreeDataBuilder = new JSTreeDataBuilder(new
    ComputerNodeProvider(computer));
  jsTreeDataBuilder.assembleJSON();

  myvariable = jsTreeDataBuilder.getJSON();

  return Action.SUCCESS;
}

public String getMyvariable() {
  return data;
}

public void setMyvariable(String data) {
  this.myvariable = myvariable;
}

}

So the point is, it doesn't work and I don't know how to fix it.

Kind regards,
Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to