As a quick fix, we ran into this as well when we enclosed our DataTables in 
<h:form> components.  Try moving the <h:form> to just the pieces that need it, 
and it should allow your action to be called.  I agree that this is a bug (just 
trying to provide a work-around). 

-----Original Message-----
From: Brandon Goodin (JIRA) [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 25, 2005 1:47 PM
To: [email protected]
Subject: [jira] Created: (MYFACES-213) commandLink does not work in dataList

commandLink does not work in dataList
-------------------------------------

         Key: MYFACES-213
         URL: http://issues.apache.org/jira/browse/MYFACES-213
     Project: MyFaces
        Type: Bug
    Versions: 1.0.9 beta    
 Environment: Tomcat 5.0, Win2k, JDK 1.4.2_06
    Reporter: Brandon Goodin
    Priority: Critical


I've been trying to get a simple commandLink to work in a dataList. I have the 
dataList bound to a UIData component (binding="#{categoryAdmin.ancestorTree}") 
on the backing bean. It properly displays links. However, when i select the 
link it fails to call the appropriate action method 
(action="#{categoryAdmin.ancestor}")and returns back to the page. No error 
meassages are written to the screen or logs.

Things i have tried with no success are:

- placing my backing bean in session rather than request
- placed <h:messages/> on the jsp to see any error messages (none appear)
- Debugged the phases in the LifeCycleImpl. It hits all the full LifeCycle 
phases 
(restoreView,applyRequestValues,processValidations,updateModelValues,invokeApplication).
 However, i am not able to determine what is really happening in these phases 
to result in the outcome.
- used h:commandLink and x:commandLink (both with session and request backing 
bean)
- set a breakpoint in my action method (public String ancestor(){...}) method 
and it never gets called.

Following is my page code. I provided the whole page to give context in case 
there are other conflicts that may be taking place. I'd be happy to provide a 
small app to reproduce this if my explanation is not enough.

<%@ taglib uri="http://java.sun.com/jsf/core";; prefix="f"%> <%@ taglib 
uri="http://java.sun.com/jsf/html";; prefix="h"%> <%@ taglib 
uri="http://myfaces.apache.org/extensions";; prefix="x"%> <h:form>

<x:dataList
id="ancestorTree"
var="ancestor"
binding="#{categoryAdmin.ancestorTree}">
<x:commandLink action="#{categoryAdmin.ancestor}" value="#{ancestor.title}"/> 
</x:dataList>

<h:commandButton  styleClass="buttonnormal"
action="#{categoryAdmin.add}" value="Add Category"/>

<h:inputHidden id="categoryAdmin_parentCategoryId"
value="#{categoryAdmin.parentCategoryId}"/>

<!-- category list -->

<h:dataTable style="margin: 10px; border: 1px solid black"
var="category" binding="#{categoryAdmin.categoryTable}">

<h:column>
<f:facet name="header">
<h:outputText value="Title" style="border-bottom: 1px solid black"/> </f:facet> 
<h:commandLink action="#{categoryAdmin.child}"> <h:outputText 
value="#{category.title}"/> </h:commandLink> <f:facet name="footer"> 
<h:outputText value="" style="border-top: 1px solid black"/> </f:facet> 
</h:column>

<h:column>
<f:facet name="header">
<h:outputText value="" style="border-bottom: 1px solid black"/> </f:facet> 
<h:commandLink action="#{categoryAdmin.edit}"><h:outputText
value="Edit"/></h:commandLink>
<f:facet name="footer">
<h:outputText value="" style="border-top: 1px solid black"/> </f:facet> 
</h:column>

<h:column>
<f:facet name="header">
<h:outputText value="Tree" style="border-bottom: 1px solid black"/> </f:facet> 
<h:outputText value="#{category.ancestorTree}"/>
<f:facet name="footer">
<h:outputText value="" style="border-top: 1px solid black"/> </f:facet> 
</h:column>

</h:dataTable>

<h:commandButton  styleClass="buttonnormal"
action="#{categoryAdmin.add}" value="Add Category"/>

</h:form>

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to