I'm trying to compare two different object in JSF. A String and an Integer, of cours it don't work...
That does not sound right - I would check the values. For the bean:
public class CoercedBean {
public int getValueAsInt() {
return 123;
}
public String getValueAsString() {
return "123";
}
}
...these example expressions evaluate to true:
${coercedBean.valueAsInt == coercedBean.valueAsString}
<h:outputText style="color: blue"
value="#{coercedBean.valueAsInt eq coercedBean.valueAsString}" />
The JSP 2.1 (EL) spec says of evaluating equality:
A {==,!=,eq,ne} B
If A or B is Byte, Short, Character,
Integer, or Long coerce both A and B
to Long, apply operator