How to call one controller to another controller URL in Spring MVC?

后端 未结 5 896
长情又很酷
长情又很酷 2021-01-03 00:34

Hi I am new to Spring MVC ,I want to call method from one controller to another controller ,how can I do that .please check my code below

@Controller

    @R         


        
5条回答
  •  萌比男神i
    2021-01-03 01:17

    You never have to put business logic into the controller, and less business logic related with database, the transactionals class/methods should be in the service layer. But if you need to redirect to another controller method use redirect

    @RequestMapping(value="/updatePSWD")
    @ResponseBody
    public String updatePswd()
    {
      return "redirect:/getUser.do";
    }
    

提交回复
热议问题