今天的收获

来源:互联网 发布:淘宝装修怎么弄全屏 编辑:程序博客网 时间:2024/06/16 20:04

前台jsp页面点击“个人信息修改”按钮后,页面跳转到个人信息修改页面的过程:

1、前台jsp页面代码如下:

<div class="exitlogin_cc">        <a class="leave_the_page"  href="${ctx}/login/updateinfo.htm">个人信息修改</a>    </div>

2、点击后系统会请求到action的带有@RequestMapping("/updateinfo.htm")注解的方法中

3、系统会读取这个方法后返回前台页面ModelAndView,ModelAndView的路径就是要跳转的个人信息修改页面

 @RequestMapping("/updateinfo.htm")    public ModelAndView updateUserInfo(HttpServletRequest request, HttpSession session) throws Exception {        SecurityContext securityCtx = SecurityContextHolder.getContext();        Authentication auth = securityCtx.getAuthentication();        if (auth == null) {            throw new Exception("登陆之后才能修改");        } else {            ProUser user = (ProUser) this.getUserInfo();            TProUser proUser = this.proUserService.getUser(user);            session.setAttribute(Constant.LOGIN_PRO_USER_KEY, proUser);            return new ModelAndView("login/blue/updateuserinfo");        }    }



疑问:

为什么不能直接在第一个jsp中设置超链链接到第二个jsp页面中呢?

因为系统必须做判断,判断当事人是否已登录

原创粉丝点击