You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Obster <mi...@obster.org> on 2009/12/15 22:20:25 UTC
Anyone used jsTree with Struts2?
Hi,
is there anyone who has used jsTree in a struts2 application? Having
some problems using he component. First I don't get a JSON format
generated with struts2 which the tree understands and the 2nd try is
not even better where I changed from a JSON to XML-Code. The tree
works with that but only on non-IE browsers :-(. IE have some problems
with XML and the used Sarissa lib...
So if anyone knows a good alternative with a similiar format (xml is
preferred), please tell me.
Regards,
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Anyone used jsTree with Struts2?
Posted by Michael Obster <mi...@obster.org>.
Musachy Barroso schrieb:
> On Tue, Dec 15, 2009 at 1:20 PM, Michael Obster <mi...@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
Re: Anyone used jsTree with Struts2?
Posted by Musachy Barroso <mu...@gmail.com>.
On Tue, Dec 15, 2009 at 1:20 PM, Michael Obster <mi...@obster.org> wrote:
> jsTree
I used it with the JSON plugin many moons ago, what problem are you having?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org