JSP页面使用EL表达式不显示实际数据

今天在学习有关jsp的相关知识内容时,遇到了el表达式只是显示括号里面的内容

代码如下:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    Map maps = new HashMap();
    maps.put("aaa","111");
    maps.put("bbb","222");
    maps.put("ccc","333");
    request.setAttribute("map",maps);
%>
获取Map指定key的value值
${map.aaa}--------${map["bbb"]}
</body>
</html>

显示如下:

修改后代码: 加上<%@page isELIgnored="false"%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page isELIgnored="false"%>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    Map maps = new HashMap();
    maps.put("aaa","111");
    maps.put("bbb","222");
    maps.put("ccc","333");
    request.setAttribute("map",maps);
%>
获取Map指定key的value值
${map.aaa}--------${map["bbb"]}
</body>
</html>

结果显示:

 

 

原文地址:https://www.cnblogs.com/lx06/p/15729939.html