简体   繁体   中英

JSP expression language not working when evaluating variables

I am new to JSP and working with Tomcat 8. The problem is that JSP EL is not working properly. Like when i write ${1>2} it gives the right output but when I put a variable name in it it does not give the output. I have this in my code <%@ page import = "java.util.*" isELIgnored="false"%>

but it is still not working. This is my code:

<% 
    String GuessErrorMsg = null;
    if (GuessErrorMsg != null) {
%>
            <div class='bad-field-error-message'>${GuessErrorMsg}</div>
<%
    }  
%>

i found the problem in my code due which i could not get the EL expresion evaluated. so i am sharing it with everyone. it may be a very beginner's mistake thats what I am. the problem was that i have not set the variable using setAtrribute(Expression,variable) .thats why i wasnt getting the value .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM