I'm wondering which of those two code snippets is more efficient.
First one
In userSearch.xhtml
:
<rich:dataTable
var="user"
value="#{userSearchResultList}"
rendered="#{not empty userSearchResultList}">
...
</rich:dataTable>
In UserSearchAction.java
:
@Produces @RequestScoped
@Named("userSearchResultList")
public List<User> getResultList() {
return resultList;
}
Second one
In userSearch.xhtml
:
<rich:dataTable
var="user"
value="#{userSearchAction.resultList}"
rendered="#{not empty userSearchAction.resultList}">
...
</rich:dataTable>
In UserSearchAction.java
:
public List<User> getResultList() {
return resultList;
}
In both solutions, my resultList
variable is filled by a method UserSearchAction.search()
.
I'm using JBoss 7.0.2.Final and RichFaces 4.1.0.Final.
More generally, I wanted to know if it's better to write producers than to call sub-properties of some classes in JSF files.