最简单的EL表达式

在servlet中,

        int a=10;

        request.setAttribute("a",a)

        request.getRequestDispatcher("/index.jsp").forward(request, response);

在jsp中,

        ${a+6}

浏览器访问servlet,转发到jsp,输出16。

如果直接访问jsp,会输出6,a没有初始化。

原文地址:https://www.cnblogs.com/cuishh/p/12796345.html