Two conditions in c: if

0

I want to add two conditions to an if in JSTL, but it throws me an error.

<c:if test="${ISAJAX == 0 && ${ISDATE == 0}"> 
  

Compilation of JSP File '/WEB-INF/pages/index.jsp' failed:

     

homeafiliado.jsp: 792: 61: Syntax error in expression. Encountered "{".

I remain attentive, Regards.

    
asked by Stevn 16.05.2017 в 22:37
source

2 answers

2

Expression Language (EL, the content within ${} ) serves to parse expressions and convert them into Java code. You do not need to imbibe Him within Him. Your expression can be corrected by removing the ${} internal.

It should look like this:

<c:if test="${ISAJAX == 0 && ISDATE == 0}">

You can even rewrite it in a simpler way to understand:

<c:if test="${ISAJAX eq 0 and ISDATE eq 0}">
    
answered by 16.05.2017 / 23:00
source
1

The UEL processor only processes what is inside a construction ${...} .

Solution: The whole expression must be inside the keys.

<c:if test="${ISAJAX == 0 && ISDATE ==0}"/> <!-- CORRECTO -->

Avoid even leaving blank spaces outside the keys,

<c:if test="${ISAJAX == 0 && ISDATE ==0} "/> <!-- Error, porque a test se le asignará "false " o "true " (espacio en blanco al final)--> 

because both "true " and "false " are converted to false ( link )

    
answered by 16.05.2017 в 23:00