10029---关于EL表达式中requestScope和param区别
来源:互联网 发布:淘宝卖东西到店自提 编辑:程序博客网 时间:2024/05/17 04:58
原文
今天演示EL表达式的时候发现自己jsp的基础实在是薄弱,在这个很简单的问题上迷惑了很久。
首先在看遇到的问题:
在浏览器地址输入,表示传入一个参数test,值为123
http://localhost:8888/Test/index.jsp?test=123
在index.jsp中尝试使用EL表达式取出,代码如下:
<body> ${test} </body>
发现毫无结果,再使用requestScope尝试取出:
<body> ${requestScope.test} </body>
发现还是毫无结果,感到非常诧异,遂干脆使用java脚本尝试取出。
<body> <%request.getAttribute("test"); %> </body>
依然无解。
之后发现,若使用已下代码向request作用域赋值,则用上面代码可以取出
<% request.setAttribute("test", "123"); %>
查询资料后发现,使用以下代码可以取出之前的请求参数:
EL:
<body> ${param.test} </body>
JAVA脚本:
<body> <%=request.getParameter("test") %> </body>
结论就是:${param.name} 等价于request.getParamter("name"),这两种方法一般用于服务器从页面或者客户端获取的内容。
${requestScope.name} 等价于 request.getAttribute("name") 等价于等价于${name},一般是从服务器传递结果到页面,在页面中取出服务器保存的值。
结论不确切。 0 0
- 10029---关于EL表达式中requestScope和param区别
- 关于EL表达式中requestScope和param区别
- 关于EL表达式中requestScope和param区别
- 关于EL表达式中requestScope和param区别
- 关于EL表达式中requestScope和param区别
- 关于EL表达式中requestScope和param区别
- 关于EL表达式中requestScope和param区别
- 关于EL表达式中requestScope和param区别
- 关于EL表达式中requestScope和param区别
- 关于EL表达式中requestScope和param区别
- 关于EL表达式中requestScope和param区别
- 关于EL表达式中requestScope和param区别
- 关于EL表达式中requestScope和param区别
- 关于EL表达式中requestScope和param区别,el表达式与jstl标签
- 关于EL表达式中requestScope和param区别,el表达式与jstl标签
- EL表达式页面传值(${param}和requestScope)
- J2EE中getParameter与getAttribute以及EL表达式${requestScope}和${param[]}
- J2EE中getParameter与getAttribute以及EL表达式${requestScope}和${param[]}
- Selenium2鼠标点击操作笔记
- 德勤:2016年科技、传媒和电信行业预测
- 关于修复Xcode7不能联网的问题
- CSS定位属性
- 如何把Excel导入到SQL Server中
- 10029---关于EL表达式中requestScope和param区别
- 网页
- Android横竖屏切换时Activity的生命周期问题
- 视音频数据处理入门:H.264视频码流解析
- ubuntu 14.04 amd64 android 驱动调试环境创建
- RxJava学习教程
- 区间的比较2
- iOS开发 ☞ Version & Build & CFBundleShortVersionString & CFBundleVersion
- 视音频数据处理入门:AAC音频码流解析