2012-09-20 14 views

risposta

24

che sta per essere un valore booleano. È possibile controllare confrontando in un

<c:if test="${refreshSent eq false}"> 

e

<c:if test="${refreshSent eq 'false'}"> 

Il secondo è un confronto di stringhe.

+5

Penso che affermando esplicitamente che il primo avrà successo e il secondo fallirà chiarirò la risposta. So che è sciocco, ma io tendo ad andare per il codice e solo dopo leggere il testo. Grazie! – Cristopher

3

Io lo uso per booleana

<c:set var="refreshSent" value="${false}"/> 
<c:if test="${refreshSent}"> 
    some code ........ 
</c:if> 
+0

Entrambi value = "$ {false}" e value = "false" valutano la stessa cosa nel test ... quindi se stai cercando di salvare caratteri, usa value = "false" (rinunciando al $ {} po...). –

1

Sì, è può essere booleano e stringa.

<c:if test="${refreshSent}"> 
    your code... 
</c:if> 

oppure è possibile utilizzare come questo

<c:if test="${refreshSent eq 'false'}"> 
    your code... 
</c:if> 

Grazie.

Problemi correlati