html - JSTL c:if statement not working -


i want able send alert if query string exists, dont need know value returns, exists.

i tried this, doesnt work:

<%  request.setattribute("appinfo", request.getparameter("appinfo")); %> <c:if test="${appinfo}"> <script> alert("${appinfo}"); </script> </c:if> 

i tried (with url being ?appinfo=88) , worked.

<% request.setattribute("appinfo", request.getparameter("appinfo")); %> <c:if test="${appinfo == 88}"> <script> alert("${appinfo}"); </script> </c:if> 

i dont understand why solution 2 works 1 doesnt, ideas?

c:if doesn't work javascript if, non-null values regarded "truthy". c:if need result true or false. can do

<c:if test="${appinfo != null}"> 

to check if value there.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -