Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

221
Views
How can I solve redirection malfunctioning problem

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;}

Look A and C

As you can see in the console every code works fine till right before the return code.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!