Get string length in EL

Is it possible to find the length of the String page in Facelets to check the status with <ui:fragment> ?

+6
source share
1 answer

If you just need to know whether it is empty or empty, use the EL empty keyword:

 <ui:fragment rendered="#{not empty bean.string}"> 

Or, if you really need to know its exact length, use the String#length() method directly:

 <ui:fragment rendered="#{bean.string.length() gt 42}"> 

Or, if you are not already using Servlet 3.0 / EL 2.2, use JSTL fn:length() :

 <ui:fragment rendered="#{fn:length(bean.string) gt 42}"> 
+23
source

Source: https://habr.com/ru/post/901254/


All Articles