More problems with commandButtons / commandLinks in datatables
We are facing a serious problem with using commandButtons and commandLinks inside datatables. Clicking on the button on start_page transitions to data_page, but clicking on the buttons on data_page does NOT transition to end_page as expected. Giving the bean a session scope fixes the problem, but that is very undesirable for our application, and we cannot understand why that's necessary.
A very simplied version is shown below. What is going on here?
faces-config.xml:
<navigation-rule>
<from-view-id>/start_page.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/data_page.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/data_page.jsp</from-view-id>
<navigation-case>
<from-outcome>done</from-outcome>
<to-view-id>/end_page.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>DataBean</managed-bean-name>
<managed-bean-class>test.DataBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
start_page.jsp:
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<html><body><f:view><h:form>
<h:commandButton value="Show Data" action="#{DataBean.makeData}" />
</h:form></f:view></body></html>
data_page.jsp:
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<html><body><f:view><h:form>
<h:dataTable var="v" value="#{DataBean.data}">
<h:column>
<h:commandButton value="Done" action="done" />
</h:column>
</h:dataTable>
</h:form></f:view></body></html>
end_page.jsp:
<html><body>Done</body></html>
DataBean.java:
package test;
publicclass DataBean{
private String[] data;
public DataBean(){}
public String[] getData( ){
return this.data;
}
public String makeData(){
this.data =new String[]{"item1","item2"};
return"success";
}
}

