EL表达式未评估 [英] EL expression not evaluated

查看:83
本文介绍了EL表达式未评估的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的测试servlet;

Here is my test servlet ;

public class EventListServlet extends javax.servlet.http.HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        process(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        process(request, response);
    }

    private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        request.setAttribute("name", "test1");
        request.getRequestDispatcher("index.jsp").forward(request, response);
    }
}

并测试jsp;

<html>
<body>
<h2>Hello World!</h2>
<p>${name}</p>
</body>
</html>

,输出为 $ {name}

它应该写成test1:/那是怎么了???

it should write test1 :/ what's wrong with that ???

推荐答案

JSP的早期版本默认禁用EL.请参阅: http://docs.oracle.com/cd /E19316-01/819-3669/bnajh/index.html

Earlier versions of JSP disable EL by default. See: http://docs.oracle.com/cd/E19316-01/819-3669/bnajh/index.html

要在此页面上启用EL评估,请尝试将以下指令放在JSP文件的顶部:

To enable EL evaluation on this page, try putting the following directive at the top of your JSP file:

<%@page isELIgnored="false" %>

这篇关于EL表达式未评估的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆