Announcement Announcement Module
Collapse
No announcement yet.
submit form after Session.SetComplete Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • submit form after Session.SetComplete

    @RequestMapping(value = "/edit.do", method = RequestMethod.POST)
    public String edit(@Valid EditUserBean editUserBean,
    BindingResult bindingResult,
    RedirectAttributes redirectAttributes,
    SessionStatus sessionStatus)
    throws NoSuchAlgorithmException, InvalidKeySpecException {

    if (bindingResult.hasErrors()) {

    redirectAttributes.addFlashAttribute("editMessage" , "message");
    return "redirect:/user";

    } else {

    UserDetails userDetails =
    (UserDetails) SecurityContextHolder.getContext().getAuthenticati on().getPrincipal();

    UserEntity userEntity = userRepository.findByUsername(userDetails.getUsern ame());

    userEntity.setEmail(editUserBean.getEmail());
    userEntity.setUsername(editUserBean.getUsername()) ;

    userRepository.save(userEntity);

    /*sessionStatus.setComplete();*/

    redirectAttributes.addFlashAttribute("editMessage" , "message");

    return "redirect:/user";

    }

    }

    this is a my controller method

    i submit my form and Session.setComplete
    after that i want to submit form again but i get null pointer exception
Working...
X