rich:tree doesn't fire selectionChange event
fpiraneo May 22, 2013 10:38 AMHi all,
I'm quite new to RichFaces and I'm integrating it into my web application.
I'm using rich:tree to allow user to make a choice in a tree; the code on xhtml page is:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ezcomp="http://java.sun.com/jsf/composite/ezcomp"
xmlns:rich="http://richfaces.org/rich">
<h:head>
<h:outputStylesheet library="css" name="main.css" />
<title>#{messages.app0}</title>
</h:head>
<h:body>
<h:form id="mainForm">
<rich:tree id="treeSingle" value="#{chooseFirm.firmsDirectory}" var="node" rendered="#{chooseFirm.firmsPresents}" selectionType="ajax" selectionChangeListener="#{chooseFirm.selectionChanged(event)}" toggleType="ajax" toggleListener="#{chooseFirm.nodeToggled(event)}" style="width:100%" />
</h:form>
</h:body>
</html>
on my chooseFirm.java bean I created the two listeners:
@ManagedBean
@SessionScoped
public class chooseFirm implements Serializable {
....some code....
public void selectionChanged(TreeSelectionChangeEvent event) {
System.out.print("*** Evento select lanciato ***");
}
public void nodeToggled(TreeToggleEvent event) {
System.out.print("*** Evento toggle lanciato ***");
}
...some other code...
}
Now the funny: on my GlassFish console I can read "INFO: *** Evento toggle lanciato ***" when I open or close a node, unfortunately I cannot read the "select" change message and my suspect is that the event is not correctly handled on the server side. Looking at the GET / POST exchanges between the browser and the server I noted that the browser correctly send the POST to server.
For references I use the Apress "Practical RichFaces (2nd ed.)" chapter 9.
Any help is strongly apreciated, thank you!
Francesco