Can we find the length of a String
in Facelets page to check for a condition using <ui:fragment>
?
If you just need to know if it's empty or null, use EL empty
keyword:
<ui:fragment rendered="#{not empty bean.string}">
Or if you really need to know its exact length, use String#length()
method directly:
<ui:fragment rendered="#{bean.string.length() gt 42}">
Or if you aren't on Servlet 3.0 / EL 2.2 yet, use JSTL fn:length()
function:
<ui:fragment rendered="#{fn:length(bean.string) gt 42}">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With