You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Mariana Getova <m....@rccit.com> on 2006/05/09 15:14:25 UTC

problem with commandLink in tree2 component

Hi!

I'm new with JSF! I have some problems with the commandLink and I'm using
myFaces tree2 component! The data for the tree come from Hibernate) and I
want each time I click a node to go to a specific page. I have an action in
a backing bean which I bind to the action attribute of the commandLink. I
pass the node identifier as a parameter and retrieve it in my action. My
problem is that when I click on some node it works fine the FIRST time and
the right page is displayed but when I click on another node the page with
my tree is displayed again as a result page and when I click some node again
then the right page is displayed. Why should I click a node twice to go to
the right page? 

I'm using Eclipse SDK, Version: 3.1.2, servlet version 2.3 and I deploy on
BEA Weblogic Server v8.1.

Here's part of my jsp:

<f:facet name="document">
<h:panelGroup styleClass="item">
<t:commandLink immediate="true"
action="#{listObjectTreeItems.retrieveParameterValue}"
styleClass="#{t.nodeSelected ? 'documentSelected':'document'}"
actionListener="#{t.setNodeSelected}" target="rightfrm">
<t:graphicImage value="/images/document.png" border="0"/>
<f:param name="nodeDetailsControl" value="#{node.identifier}"/>
<h:outputText value="#{node.description}"/>
</t:commandLink> 
</h:panelGroup>
</f:facet>
</t:tree2>

This is my action in my backing bean:

public String retrieveParameterValue()
{
selectedNodeId =
FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("nodeDetailsControl").toString();
detailsControl="";
//the collection of nodes from database
ObjectTreeNode[] objTreeList = ObjectTreeNode.list();
for (int i = 0; i < objTreeList.length; i++)
{
if (selectedNodeId.equalsIgnoreCase(objTreeList.getItemID().toString()))
{
detailsControl = objTreeList.getDetailsControl();
break;
}
}
return detailsControl;
}


I use the returned value of detailsControl for the navigation.
If you need more code I'll post it! Please, any suggestions? 
Thank you! 
--
View this message in context: http://www.nabble.com/problem-with-commandLink-in-tree2-component-t1584408.html#a4299616
Sent from the MyFaces - Users forum at Nabble.com.