修正配置controller的消息重定向后无法传至前台的问题,使用model的模式改为redirectAttributes模式

This commit is contained in:
zhangwei
2018-07-02 09:45:04 +08:00
parent ad3ccdc0a2
commit 01eebad6c1
5 changed files with 19 additions and 26 deletions

View File

@@ -53,14 +53,14 @@ public class DdosCfgController extends BaseController {
@RequestMapping(value = {"/saveOrUpdate"})
@RequiresPermissions(value={"ddos:ip:config"})
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")DdosIpCfg cfg){
@ModelAttribute("cfg")DdosIpCfg cfg, RedirectAttributes redirectAttributes){
try{
ddosCfgService.saveOrUpdate(cfg);
addMessage(model,"save_success");
addMessage(redirectAttributes,"save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
e.printStackTrace();
addMessage(model,"save_failed");
addMessage(redirectAttributes,"save_failed");
}
return "redirect:" + adminPath +"/manipulation/ddos/list?functionId="+cfg.getFunctionId();