Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I check two or more conditions in one <c:if>?

Tags:

jstl

el

How do I check two conditions in one <c:if>? I tried this, but it raises an error:

<c:if test="${ISAJAX == 0} && ${ISDATE == 0}">  
like image 207
Selva Kumar K.P. Avatar asked Dec 02 '11 11:12

Selva Kumar K.P.


People also ask

Can you have two conditions in an if statement c?

Use two if statements if both if statement conditions could be true at the same time. In this example, both conditions can be true. You can pass and do great at the same time. Use an if/else statement if the two conditions are mutually exclusive meaning if one condition is true the other condition must be false.

How many conditions can an if statement have in c?

Technically only 1 condition is evaluated inside an if , what is ascually happening is 1 condition gets evaluated and its result is evaluated with the next and so on...

What is the use of c if tag?

The < c:if > tag is used for testing the condition and it display the body content, if the expression evaluated is true. It is a simple conditional tag which is used for evaluating the body content, if the supplied condition is true.


1 Answers

This look like a duplicate of JSTL conditional check.

The error is having the && outside the expression. Instead use

<c:if test="${ISAJAX == 0 && ISDATE == 0}"> 
like image 194
olly_uk Avatar answered Oct 10 '22 16:10

olly_uk