简体   繁体   English

JSP 表达式语言在评估变量时不起作用

[英]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.我是 JSP 新手并使用 Tomcat 8。问题是 JSP EL 无法正常工作。 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.就像我写${1>2}它给出了正确的输出,但是当我将变量名放入其中时,它没有给出输出。 I have this in my code <%@ page import = "java.util.*" isELIgnored="false"%>我的代码中有这个<%@ 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.我在我的代码中发现了问题,因为我无法评估 EL 表达式。 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 .问题是我没有使用 setAtrribute(Expression,variable) 设置变量。这就是我没有得到值的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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