How do you get the length of a list in the JSF expression language?

后端 未结 7 1641
忘掉有多难
忘掉有多难 2020-12-13 03:04

How would I get the length of an ArrayList using a JSF EL expression?

#{MyBean.somelist.length}

does not work.

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 03:42

    After 7 years... the facelets solution still works fine for me as a jsf user

    include the namespace as xmlns:fn="http://java.sun.com/jsp/jstl/functions"

    and use the EL as #{fn:length(myBean.someList)} for example if using in jsf ui:fragment below example works fine

    
        
    
    

提交回复
热议问题