users@woodstock.java.net

Re: Problem with webuijsf:tree and getSelected()

From: Giulio Ferro <auryn_at_zirakzigil.org>
Date: Sun, 23 Nov 2008 17:45:49 +0100

Antonin Karasek wrote:
> Hi,
> this is not a solution, but something, that can be helpful...
>
Nope, it doesn't work.
I've tried the dynamic tree example
http://webdev2.sun.com/woodstock-tlddocs/webuijsf/tree.html
creating a new project with
a new Netbeans 6.5 installation both with linux and windows and
it's useless.

First of all, you have to change the actionListener to
actionListenerExpression
of the tree and the action to actionExpression of the button in the jsp,
otherwise it won't compile. I guess the example in the docs refers to an old
implementation of this component...

Then the getSelected() method _ALWAYS_ returns null, either in the
button's actionExpression method and in the actionListenerExpression of the
TreeNode.



> 1. Make sure, that getSelected() really returns null. Try something like:
>
> if (nodeId == null) {
> System.err.println("really null");
> return "";
> }
>
> and watch the glassfish output in NetBeans...

It does return null, really null...

>
> 2. Try to call getSelected() in actionExpression of a treeNode:
>
> <webuijsf:treeNode id="folder1" binding="#{TestTreeBean.folder1}"
> actionExpression="#{TestTreeBean.myMethod}" />
>
> public String myMethod {
> System.err.println("selected: "+getDynamicTree().getSelected());
>
> return null;
> }
>
Same as above...


> -- I'm using getSelected() in actionExpression with exactly the same
> configuration (netbeans 6.1 (last update) + glassfish v2 + sun java 6)
> and it works...

Can you try the example in the docs? Does it work for you?