EDIT: I flagged my question as a duplicate, because I've found the answer here: JSTL c:if doesn't work inside a JSF h:dataTable
I marked it as a duplicate instead of deleting it because I thought it could still help someone.
I suppose I'm making some stupid mistake, but the code inside <c:if>
executes although the expression in test should evaluate to false.
Note: I know that when using jstl there should be ${...}
instead of #{...}
but I've tried that way too and there seems to be no difference.
<c:if test="#{(auction.isActive==0)}">
<h:column>
<f:facet name="header">Auction Number</f:facet>
#{(auction.isActive)} //PRINTS 1
</h:column>
</c:if>
What am I doing wrong? I'm using JSF - the code is for a .xhtml page.
My includes:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:df="http://java.sun.com/jsf/composite/dreamcar_functions"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core">
Sorry if this seems basic but I'm making my first steps with java-ee.
Edit - The getter and setter for isActive:
public int getIsActive() {
return isActive;
}
public void setIsActive(int isActive) {
this.isActive = isActive;
}
Check out this test I made. I changed auction.isActive==0 to auction.isActive to generate an error that would tell me details about auction.isActive. It seems the value here is 0:
/add_offer.xhtml @29,39 test="#{auction.isActive}" /add_offer.xhtml @29,39 test="#{auction.isActive}": Cannot convert 0 of type class java.lang.Integer to class java.lang.Boolean