如何在JSP中按请求访问属性? [英] How to access at request attributes in JSP?

查看:62
本文介绍了如何在JSP中按请求访问属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用:

<%
final String message = (String) request.getAttribute ("Error_Message");
%>

然后

<%= message %>

但是我想知道是否可以使用EL或JSTL而不是使用scriptlet来完成相同的工作.

However I wonder if the same can be done with EL or JSTL instead of using a scriptlet.

推荐答案

EL表达式:

${requestScope.Error_Message}

JSP EL中有几个隐式对象.请参见表达语言. //docs.oracle.com/javaee/1.4/tutorial/doc/JSPIntro7.html#wp71043"rel =" nofollow noreferrer>隐式对象" 标题.

There are several implicit objects in JSP EL. See Expression Language under the "Implicit Objects" heading.

这篇关于如何在JSP中按请求访问属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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