`

ActionContext.getContext().getSession()

    博客分类:
  • J2EE
 
阅读更多
ActionContext.getContext().getSession()

 

这个方法获得的不是HttpSession对象,而是一个Map对象。

要存值进去或者取值需要用以下方法

ActionContext.getContext().getSession().put("validateCode", s); 

ActionContext.getContext().getSession().get("validateCode")

 以上方法和session.setAttribute();session.getAttribute();的作用相同,并且可以混用

分享到:
评论

相关推荐

    Struts2_TypeConvertion

    B.ActionContext ct= ActionContext.getContext() HttpServletRequest request= (HttpServletRequest)ct.get(ServletActionContext. HTTP_REQUEST ); 获得session对象: 在Struts2中底层的session都被封装成了...

    JS客户端RSA加密,Java服务端解密

    ActionContext.getContext().put("exponent", new String(Hex.encodeHex(publicKey.getPublicExponent().toByteArray()))); // 页面里,Javascript对明文进行加密: 09 var modulus = $('#hid_modulus').val(); var...

    struts2验证码完整实例

    通过ActionContext.getContext().getSession().put("random", randomNum.getRandomCode())将数字存放到session当中 2、当你登录时候,提交的输入框中的验证码和session中存放的验证码比较,如果一样,则通过,不一样,则...

    Struts2实战总结

    1:在action中定义的变量,在jsp页面中显示用:变量名" /> ...Map session = ActionContext.getContext().getSession(); HttpServletRequest request = ServletActionContext.getRequest (); 设置它们的值的方法

    基于struts2注册登录ActionContext.zip

    struts2大量使用拦截器来处理请求,从而允许与业务逻辑控制器 与 servlet-api分离,避免了侵入性(所谓侵入性就是指的这个架构设计出来的部件对系统的影响范围,标签库几乎可以完全替代JSTL的标签库,并且 struts2.x...

    struts2中范围对象的操作

    ActionContext actionContext=ActionContext.getContext(); Object obj=actionContext.get("objName");----Object obj=request.getAttribute("objName"); actionContext.put("objName",objName);---request....

    Struts2访问servlet分享

     ActionContext ctx = ActionContext.getContext();  ctx.getApplication().put(“app”, “应用范围”);//往ServletContext里放入app  ctx.getSession().put(“ses”, “session范围”);//往session里放入ses  ...

    javaee三大框架整合宅急送项目lib包

    ActionContext.getContext().put("zhongZhuanInfoList", zhongZhuanInfoList); return "findInStoreTaskSUCCESS"; } // 业务方法 ----- 查询出库环节 的个人任务 public String findOutStoreTask...

    struts2文件上传,与struts2-xml校验

    System.out.println("上下文路径="+ ActionContext.getContext()); System.out.println("aaa="+ServletActionContext.getActionContext(ServletActionContext.getRequest())); filename=new String[myFile....

    Struts2注解+JDBC+MySQL小项目应用

    Map, Object> session = ActionContext.getContext().getSession(); session.put("userName", userName); session.put("passWord", passWord); // 2. taglib标识传递 resultMsg = "注册成功"; return ...

    java 同一用户不能同时登陆问题

    import com.opensymphony.xwork2.ActionContext; public class DialogHttpSessionListner implements HttpSessionListener { private static Map, HttpSession> httpssessionmap = new Hashtable, HttpSession>();...

    xwork-core-2.3.37.jar

    用于解决struts2升级至2.3.37时 出现java.lang.NoSuchMethodError: com.opensymphony.xwork2.ActionContext.put(Ljava/lang/异常时,更换的xwork-core-2.3.37.jar

    struts2-junit-plugin-2.1.8.jar

    可解决java.lang.NoSuchMethodError: com.opensymphony.xwork2.ActionContext.get(Ljava/lang/Object;)Ljava/lang/Object; java.lang.ClassNotFoundException: com.opensymphony.xwork2.util.TextUtils struts2.1.8...

    struts2OGNL表达式ActionContext及valuesStack.pdf

    struts2OGNL表达式ActionContext及valuesStack.pdf

    Struts2 s2-061 Poc分析1

    简介分析性。2. 已实例类的法调 (OgnlContext 中的对象),不允许调静态法idea 中可以通过 ActionContext.actionContex

    指定IP地址才能访问API

    string ip = IpHelper.GetRealIP(); if (ip == ConfigurationManager.AppSettings["ApiUrl"]) { //HttpContext.Current.... actionContext.Response = new HttpResponseMessage(System.Net.HttpStatusCode.OK); }

    Flux应用可插拔容器Fluxible.zip

     actionContext.dispatch('FOO_ACTION', payload); }; // Store const FooStore = createStore({  storeName: 'FooStore',  handlers: {  'FOO_ACTION': 'fooHandler'  },  initialize: () => { /...

    ActionContext在struts2.0中的详细应用

    ActionContext(com.opensymphony.xwork.ActionContext)是Action执行时的上下文,上下文可以看作是一个容器(其实我们这里的容器就是一个Map而已),它存放放的是Action在执行时需要用到的对象

    fluxible-plugin-waterline-models:Fluxible应用程序的插件,可以在客户端和服务器上同构使用Waterline

    适用于水线的水线模型插件 应用程序的插件,同构使用客户端和服务器上的 。 概括 该插件在Fluxible ActionContext上公开了一个models属性,用于在操作创建者... 这允许使用actionContext.models.ModelName ,它可能比mo

    三大框架下分页源代码

    ActionContext.getContext().put("news",list); return "findAllSuccess"; }else{ return ERROR; } } //分页算法 public Integer getRowsno(){ Integer totalElements = newsService.getRows...

Global site tag (gtag.js) - Google Analytics