struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Obster <mich...@obster.org>
Subject Re: Anyone used jsTree with Struts2?
Date Wed, 16 Dec 2009 05:23:50 GMT
Musachy Barroso schrieb:
> On Tue, Dec 15, 2009 at 1:20 PM, Michael Obster <michael@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message