Java JSP 表达式语言获取参数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26747831/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JSP Expression Language get parameter
提问by Victor2748
I am trying to get a String
parameter "username"
from the request
with Expression Language.
I've done some research, but couldn't find a way to do so, I would like something similar to ${pageContext.request.parameter.username}
我正在尝试从with Expression Language获取String
参数。我已经做了一些研究,但找不到这样做的方法,我想要类似的东西"username"
request
${pageContext.request.parameter.username}
How get a specific request parameter, using only expression language?
如何仅使用表达式语言获取特定请求参数?
采纳答案by CE ZHANG
If get an attribute from 'session', try this ${username}.
如果从 'session' 获取一个属性,试试这个 ${username}。
If get an parameter from 'request', try this ${param.username}.
如果从 'request' 得到一个参数,试试这个 ${param.username}。
回答by Santhosh
The syntax to get the attributes from session would be,
从会话中获取属性的语法是,
${sessionScope[name]}
And for the request attributes , you can use
对于请求属性,您可以使用
${param[name]}
For more info,
欲了解更多信息,