Calling arbitrary methods like size() isn't supported in EL 2.1,
although I think it might be in EL 2.2.
Here's the way to do it that will work in any version of JSF.
xmlns:jstl="http://java.sun.com/jsp/jstl/functions"
[...]
<h:outputText
value="#{jstl:length(item.professors)} tot
projects"/>
On Thu, Feb 20, 2014 at 11:21 AM, maurojava <[email protected]> wrote:
> From the projectController , i have a method: getCollectionProject that
> return a List<Project> .
> Each project contains a list of Professor .
> SO into the last line i would show the amount of professors for the project
> .
>
> The var item rappresent a project.
> project contains a List<Professor>
> i write "#{item.professors.size()}" for get the amount of professors for
> the project valutated form each iteration .
>
>
> Whi into the last outputText :
> <h:outputText value="#{item.professors.size()} tot projects"/>
>
> it shows only the words tot projects and not show the value of listSize?
>
>
> --------------------------------
>
> <h:form>
>
> <h:outputText value="List"/>
> <h:dataTable value="#{projectController.collectionProject}"
> var="item">
> <h:column>
> <f:facet name="header">
> <h:outputText value="Id"/>
> </f:facet>
> <h:outputText value="#{item.id}"/>
> </h:column>
> <h:column>
> <f:facet name="header">
> <h:outputText value="name of project"/>
> </f:facet>
> <h:outputText value="#{item.name}"/>
> </h:column>
>
> <h:column>
> <f:facet name="header">
> <h:outputText value="numbers of professors"/>
> </f:facet>
> <h:outputText value="#{item.professors.size()} tot
> projects"/>
> </h:column>
>
>
> </h:dataTable>
> </h:form>
>
>
>
> --
> View this message in context:
> http://myfaces.10567.n7.nabble.com/problem-wit-hvisualize-a-size-of-colletion-into-a-datatable-tp117242.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.