I have an outputText
field for which I write a condition in the rendered
attribute. The condition is for comparing the length of the string with some numeric value.
<h:outputText id="emailaddress"
value ="#{subsAlertsHelper.personEmail.substring(0,20)}"
rendered="#{subsAlertsHelper.personEmail.length() >20}" />
If I use ==
or !=
in rendered
it is working fine. But for greaterthan and lessthan it is not giving the output. What could be the reason for that?
You have to use gt
and lt
operators.
Check out JavaServer Faces Expression Language Intro from Sun/Oracle. Precisely the Operators section.
rendered
only accepts EL expression.
subsAlertsHelper.personEmail.length()
is incorrect.
On the personEmail object, add a method getLength()
witch returns the length
public int getLength(){ return this. length();}
Modify :
rendered="#{subsAlertsHelper.personEmail.length >20}"
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