S2SH在loginAction里的login方法使用
ActionContext.getContext().getSession().put("userName", userName);
再把get("userName")打印出来,确实已经put进去了然后在loginAction里的editcode方法调用service类
userInfoService.updatecode(userCode, newuserCode)userInfoService的updatecode()是这样的
String userName = (String) ActionContext.getContext().getSession().get("userNa
me");这时ActionContext.getContext().getSession().get("userName")的返回值是null用IETester里的IE6去打开页面,就会得到null用myeclipse自带的浏览器去打开页面,用getSession().get能得到userName的值,但在update(User)的时候
就报错!
无法更新标识列 'id'  但我没有去更新标识列啊,只是更新了userCode而已啊~~~~~

解决方案 »

  1.   

          进入jsp页面后才能获取到值,不信你试试
      

  2.   


    那就是要把用户修改密码的模块放在Jsp里了吗?不能用action来做?
      

  3.   

    你为啥要在service层来获取这个session值呢  你的service层中的ActionContext.getContext().getSession().get("userName");中的ActionContext有值吗?如果这个都是一个空的对象,那么获取userName肯定也就获取不到值,你查查看  ,一般在action中获取值啊,不行你在action层中获取这个值试试。
      

  4.   

    service得不到ActionContext吧。应该在action里面完成的吧
      

  5.   

    把标红的那段获取值放到action中去获取一下看看。
      

  6.   

    我在loginAction中的方法login()里用这一句:
    ActionContext.getContext().getSession().put("userName", userName);
    随即get出来是能得到值的。
    而同样在这个action里的另一个方法 editcode()里,用:
    ActionContext.getContext().getSession().get("userName");
    还是空值啊~~~难道要在另一个action里调用get才能得到这个key的值?