h:commandLink inside a t:datatable doesn't work
-----------------------------------------------

         Key: TOMAHAWK-444
         URL: http://issues.apache.org/jira/browse/TOMAHAWK-444
     Project: MyFaces Tomahawk
        Type: Bug

  Components: Extended Datatable  
    Versions: 1.1.2    
 Environment: Running on Windows XP SP2; Oracle JDeveloper 10.1.3.0.4 (Server 
OC4J embeded); Sun RI 1.1_01; Tomahawk 1.1.2
    Reporter: Pedro InĂ¡cio


When upgrading to tomahawk 1.1.2 the following code doesn't work. If we have a 
h:commandLink inside of a t:datatable, the link doesn't work. 

Even more, if we substitute t:datatable by a h:datatable, the code also doesn't 
work. Although if we put the previous version of tomahawk 1.1.1 the code works 
(and substituing t:datatable by h:datatable also works....)


The example follows:

Here is the test page:

<?xml version='1.0' encoding='windows-1252'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"; version="1.2"
xmlns:h="http://java.sun.com/jsf/html";
          <t:dataTable var="x" value="#{tomaHLink.model}">
            <t:column>
                <h:outputText value="#{x.cidade}"/>
            </t:column>
            <t:column>
      
              <h:commandLink action="#{tomaHLink.goPage}" value="#{x.distrito}">
              </h:commandLink>
                            <h:commandLink action="#{tomaHLink.goPage}" 
value="#{x.distrito}2">
              <t:outputText value="#{x.distrito}"/>
              </h:commandLink>
            </t:column>
          </t:dataTable>

<h:commandLink action="#{tomaHLink.goPage}">
<h:outputText value="cagallll"/>
</h:commandLink>

<h:commandLink action="#{tomaHLink.pagex}" value="sisisis" id="dddd"/>



<h:commandButton value="commandButton1" action="#{tomaHLink.pagex}"/>
</h:form></body>
</html>
</f:view>
</jsp:root>

The bean

package projectotestes;

import java.util.ArrayList;
import java.util.List;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;

public class TesteTomaHLink{
private DataModel model;

public TesteTomaHLink(){

model = new ListDataModel(getList());
}

public List getList(){
List al = new ArrayList();
Vo vo = new Vo();

vo.setCidade("A");
vo.setDistrito("a");

al.add(vo);
vo = new Vo();
vo.setCidade("B");
vo.setDistrito("b");
al.add(vo);
vo = new Vo();
vo.setCidade("C");
vo.setDistrito("c");
al.add(vo);

return al;

}

public DataModel getModel(){

return model;
}

public String goPage(){

return ((Vo) getModel().getRowData()).getDistrito();

}

public String pagex(){

return "a";
}
}


The Vo
package projectotestes;

public class Vo{

public String cidade;
public String distrito;

public Vo(){
}

public void setCidade(String cidade){
this.cidade = cidade;
}

public String getCidade(){
return cidade;
}

public void setDistrito(String distrito){
this.distrito = distrito;
}

public String getDistrito(){
return distrito;
}
}


And faces-config
<?xml version="1.0" encoding="windows-1252"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd";>
<faces-config xmlns="http://java.sun.com/JSF/Configuration";>

<navigation-rule>
<from-view-id>/testeTomaHLink.jspx</from-view-id>
<navigation-case>
<from-outcome>a</from-outcome>
<to-view-id>/a.jspx</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>b</from-outcome>
<to-view-id>/b.jspx</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>c</from-outcome>
<to-view-id>/c.jspx</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>tomaHLink</managed-bean-name>
<managed-bean-class>projectotestes.TesteTomaHLink</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</faces-config>

And web.xml

<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd";>
<web-app>
<description>Empty web.xml file for Web Application</description>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>35</session-timeout>
</session-config>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
</web-app>

-- 
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