登陆的action中execute代码:
Map mapsession = ActionContext.getContext().getSession();
String randcheck = (String) mapsession.get("validateCode");
mapsession.put("validateCode", null);
if (!randcheck.equals(check))
{
this.addFieldError("check", "验证码输入有误,请重新输入");
return INPUT;
}

if (loginService.userpass(username, password))
{
System.out.println("userpass returns true");
HttpServletRequest request = ServletActionContext.getRequest();
HttpSession session = request.getSession();
session.setAttribute("login", "vip");
this.setLogin((String) session.getAttribute("login"));
System.out.println("the values login in session is"+(String) session.getAttribute("login"));
return SUCCESS;
} else
{
this.addFieldError("username", "用户名或密码错误");
return INPUT;
}

解决方案 »

  1.   

    注册action中的execute方法中的代码:
    Map session = ActionContext.getContext().getSession();
    String randcheck = (String) session.get("validateCode");
    session.put("validateCode", null);
    if (!randcheck.equals(check))
    {
    this.addFieldError("check", "验证码输入有误,请重新输入");
    return INPUT;
    }

    // 模拟生成密码
    this.setAftermd5(this.username.substring(3, 6) + this.sex
    + this.password.substring(2, 4));

    if (regist2Service.insertUser(username, password, email, sex, keyword,
    realname, tel, re, years, months, days,check))
    {
    return SUCCESS;
    } else
    return ERROR;
      

  2.   

    return 之前把所有的缓存清空
      

  3.   

    return 之前把所有的缓存清空 
    这怎么操作??
    是在服务器端清楚??
      

  4.   

    就会一直报验证码错误。1 你的验证码应该是一次性的
    2 第二次登陆一定要重新生成验证码
    3 第二次当然也需要输入验证码OVER
      

  5.   

    说错了   是不能引起action中execute方法的执行,
    set方法还是执行了