Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

227
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda