I have a h:dataTable
that displays ProfileNotification
like below:
<h:dataTable value="#{myBean.profileNotifications}" var="item"
rendered="#{myBean.renderProfileNotification}">
<h:column>
<h:form>
<h:outputText value="#{item.userName} "/>
<h:outputText value="commented on your profile. "/>
<!-- <h:outputText value="[#{item.createTime}]"/> -->
</h:form>
</h:column>
</h:dataTable>
when I dont have the item.createTime
, if I click a commandLink
to set renderProfileNotification=true
, it print out 4 items. However, if i uncommented item.createTime
, the it only print out 1 item, the first item.
EDIT: The problem is the []
inside value
. Since BalusC suspect that this is an EL bug, I reproduce my bug in a small, readable and reproducible code. This code run on Glassfish v3.0.1 b22
index.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>TODO supply a title</title>
</h:head>
<h:body>
<h:form id="table">
<h:dataTable value="#{myBean.temp}" var="item" rendered="#{myBean.display}">
<h:column>
<h:outputText value="[#{item}]"/>
</h:column>
</h:dataTable>
</h:form>
<h:form>
<p:commandLink value="Display" actionListener="#{myBean.setDisplay}" update="table"/>
</h:form>
</h:body>
</html>
myBean.java
@ManagedBean(name="myBean")
@SessionScoped
public class myBean {
List<String> temp = null;
public myBean() {
}
private boolean display = false;
@PostConstruct
public void init(){
temp = new ArrayList<String>();
temp.add(0, "Tom");
temp.add(1, "Peter");
temp.add(2, "Mike");
temp.add(3, "Fox");
}
public List<String> getTemp() {
return temp;
}
public void setTemp(List<String> temp) {
this.temp = temp;
}
public boolean isDisplay() {
return display;
}
public void setDisplay() {
this.display = !this.display;
}
}