Hello I've having a problem with redirection issue. After I submit my form from another page and transmit data with ajax the controller works fine and scripts it's codes. But the error occurs when it gets to the redirection part. I've settled the return type as String and the return value as "redirect/addcomplete"(the page where I'm trying to redirect) however, its not working.
here are some of my codes can anyone see the error?
This is the Controller file
@RequestMapping(value="/addok")
@ResponseBody
public String addok(@RequestParam Map<String,String> paramMap, HttpSession session)throws Exception{
String userid= paramMap.get("userid");
UserDTO dto= new UserDTO();
dto.setName(paramMap.get("name"));
dto.setProfileImg(paramMap.get("profileImg"));
dto.setEmail(paramMap.get("email"));
dto.setUserid(paramMap.get("userid"));
dto.setNickname(paramMap.get("nickname"));
dto.setInfo(paramMap.get("info"));
session.setAttribute("name", dto.getName());
session.setAttribute("email", dto.getEmail());
session.setAttribute("profileImg", dto.getProfileImg());
session.setAttribute("userid", paramMap.get("userid"));
session.setAttribute("nickname", dto.getNickname());
session.setAttribute("info", dto.getInfo());
session.setAttribute("token", session.getAttribute("token"));
System.out.println("A");
System.out.println(dto.getName());
System.out.println(dto.getNickname());
int i=userService.updateUser(dto,userid);
System.out.println("C");
return "/addcomplete";
}
@RequestMapping("/addcomplete")
public ModelAndView addcomplete() {
ModelAndView mv = new ModelAndView();
mv.setViewName("addcomplete");
return mv;}
As you can see in the console every code works fine till right before the return code.