SpringMVC以post方式提交表單(spring RedirectView post提交)

本文采用spring3.0說明解決方案:

重點在:

RedirectView("/j_spring_security_check", true, false, true);//false代表以post方式提交請求

第二個參數覺得是否提交, 否則安全框架默認不允許get的方式提交。

 

 

 

@RequestMapping(value = "caLogin.html") public RedirectView caLogin(HttpServletRequest request, ModelMap model) throws Exception { String caStr=this.getCaStr(request); if(!StringUtils.hasLength(caStr)) throw new CAException(caStr+" CA服務器認證失敗!請確認是否插入key"); User user=BeanHelper.getBean(UserService.class).getUserByCa(caStr); log.info("ca證書="+caStr+" ca用戶="+user.getName()); model.put("j_username", user.getUsername()); model.put("j_password", user.getPassword()); return new RedirectView("/j_spring_security_check", true, false, true);//false代表以post方式提交請求 }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章