JSF <c: if> with another type of object
2 answers
I am trying to compare two different objects in JSF. String and integer, this does not work ...
That doesn't sound right - I would check the values. For bean:
public class CoercedBean {
public int getValueAsInt() {
return 123;
}
public String getValueAsString() {
return "123";
}
}
... these expressions express true :
${coercedBean.valueAsInt == coercedBean.valueAsString}
<h:outputText style="color: blue"
value="#{coercedBean.valueAsInt eq coercedBean.valueAsString}" />
The JSP 2.1 (EL) specification talks about equality assessment:
A {==,!=,eq,ne} BA B - Byte, Short, Character, A, B to Long,
+4