首页 新闻 会员 周边

SpringMVC redirect相关问题

0
悬赏园豆:30 [待解决问题]

有个删除页面,删除完成后用SpringMVC redirect到列表页面,代码如下:

@RequestMapping(value ="/{id}/delete",method = RequestMethod.GET)
    public String delete(@PathVariable String id,HttpServletRequest request) {
        userService.deleteById(id);
        return "redirect:/user/list";
    }

配置有一个全局的拦截器

    public void postHandle(HttpServletRequest request, HttpServletResponse response,
            Object handler, ModelAndView modelAndView) throws Exception {
        if (null == modelAndView) {
            return;
        }
        // 系统配置参数
        String basePath = HttpUtils.getBasePath(request);
        String contextPath = HttpUtils.getContextPath(request);
        modelAndView.addObject("basePath", basePath);
        modelAndView.addObject("contextPath", contextPath);
    }

现在的问题是,redirect后的地址栏总是将modelAndView中的参数拼接上了,如下:

http://localhost:8080/macaque/user/list?basePath=http%3A%2F%2Flocalhost%3A8080%2Fmacaque&ssss=%2Fmacaque&contextPath=%2Fmacaque

但是如果用response.sendRedirect("")的话 地址栏正常如下: 

http://localhost:8080/macaque/user/list

求助 这是什么原因呢,怎么解决





问题补充:

求大虾帮助啊

Macaque的主页 Macaque | 初学一级 | 园豆:56
提问于:2014-05-14 13:55
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册