光辉飞翔

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
统计
 

 1。。

 final HttpServletRequest request = ServletActionContext.getRequest();
  HttpSession session = request.getSession();
  String verifyCode = (String) session.getAttribute("verifyCode");
  String clientVerifyCode = request.getParameter("verifyCode");

  if (session.getAttribute("verifyPic") != null) {
   if (!(StringUtils.hasText(verifyCode) && StringUtils.hasText(clientVerifyCode) && clientVerifyCode
     .equalsIgnoreCase(verifyCode))) {
    this.addActionError("验证码输入错误!");
    return "login";
   }
  }
  String k = PasswordHash.encrypt(this.getPassword());
  final CustomerAccess access = this.customerAccessService.login(username, k);
  if (access == null) {
   this.addActionError("登录失败,请重新登录!");
   session.setAttribute("verifyPic", "true");
   return LOGIN;
  }

对session中去到的verifycode运用完后,删除属性。

  session.removeAttribute("verifyPic");

 

2。。JSP页面中:

<%

 String path = request.getContextPath();
 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
 ActionContext.getContext().put("basePath",basePath);

 CustomerUserBean user = (CustomerUserBean) session.getAttribute("User");

  ActionContext.getContext().put("isAdmin",user.getUserRecord().getIsadmin());
%>

<s:property value="#basePath" />

<s:property value="#session.User.userRecord.unit.orgId" />

<s:property value="#isAdmin" />

 

 

 

posted on   光辉飞翔  阅读(163)  评论(0编辑  收藏  举报
编辑推荐:
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
阅读排行:
· 全网最简单!3分钟用满血DeepSeek R1开发一款AI智能客服,零代码轻松接入微信、公众号、小程
· .NET 10 首个预览版发布,跨平台开发与性能全面提升
· 《HelloGitHub》第 107 期
· 全程使用 AI 从 0 到 1 写了个小工具
· 从文本到图像:SSE 如何助力 AI 内容实时呈现?(Typescript篇)
 
点击右上角即可分享
微信分享提示