<c: if test => is always true

I adhere to the following code. On the JSP page, I want to write different things depending on which browser the browser is enabled on. the terminal value is set correctly in the controller, but when the following code is executed, all conditions 3 c: if are considered valid and three sentences are displayed

<c:if test="${terminal=='android'}"> <p>you are on android</p> </c:if> <c:if test="${terminal=='iphone'}"> <p>you are on iphone </p> </c:if> <c:if test="${terminal=='other'}"> <p>you are on an other terminal </p> </c:if> 

To check if this condition is normal, I added the following code that correctly returns true, false, false when accessing from Android.

 <p> ${terminal=='android'}</p> <p>${terminal=='iphone'}</p> <p>${terminal=='other'}</p> 

Thanks in advance

+7
jsp el
source share
1 answer

I just forgot about the correct inclusion of the library

Added

 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 

at the beginning of the file just works

Found an answer while viewing comments

https://stackoverflow.com/questions/10800010/jstl-cif-test-cif?rq=1

+6
source share

All Articles