ActionContext.getContext()的基本用法
来源:互联网 发布:2013nba东部决赛数据 编辑:程序博客网 时间:2024/06/06 12:50
为了避免与Servlet API耦合在一起,方便Action类做单元测试,Struts 2对HttpServletRequest、HttpSession和ServletContext进行了封装,构造了三个Map对象来替代这三种对象,在Action中,直接使用HttpServletRequest、HttpSession和ServletContext对应的Map对象来保存和读取数据。
(一)通过ActionContext来获取request、session和application对象的LoginAction1
在JSP中读取
(二)直接使用ActionContex类的put()方法
ActionContext.getContext().put("greeting", "欢迎您来到http://www. sunxin.org");
然后在结果页面中,从请求对象中取出greeting属性,如下:
${requestScope.greeting} 或者 <%=request.getAttribute("greeting")%>
阅读全文
0 0
- ActionContext.getContext()的基本用法
- ActionContext.getContext()的用法
- ActionContext.getContext()的用法心得
- 关于ActionContext.getContext()的用法
- ActionContext.getContext()的用法心得
- 关于ActionContext.getContext()的用法
- 关于ActionContext.getContext()的用法心得
- 关于ActionContext.getContext()的用法心得
- 关于ActionContext.getContext()的用法心得
- 关于ActionContext.getContext()的用法心得
- 关于ActionContext.getContext()的用法心得
- 关于ActionContext.getContext()的用法心得
- 关于ActionContext.getContext()的用法心得
- 关于ActionContext.getContext()的用法心得
- 关于ActionContext.getContext()的用法心得
- 关于ActionContext.getContext()的用法心得
- 关于ActionContext.getContext()的用法心得
- 关于ActionContext.getContext()的用法心得
- 转的一杂谈
- 神经网络中的sigmoid函数
- 安卓- apk安装出现闪退java.lang.RuntimeException: Unable to instantiate application
- Unity 5.x UGUI 控件使用
- HyperLedger/fabric1.0.0正式版安装部署
- ActionContext.getContext()的基本用法
- lambda表达式及3个内置函数
- Python 随机生成200个优惠码
- Ignatius and the Princess IV
- Common Subsequence||HDU1159
- RocketMQ存储篇——MapedFileQueue
- 小程序-初学篇
- 面试题55. 表示数值的字符串
- [Mark] python 聚类分析 kmeans() 函数使用时报错