How to call one controller to another controller URL in Spring MVC? -
Hello I'm new to Spring MVC, I want to call method from one controller to another, I can do this. Please see your code below
@Controller @RequestMapping (value = "/ getUser") @ResponseBody public user getUser () {user U = new user (); // My Dao method is active here and I will get some user exchange; } @controller @ requestmapping (value = "/ updatePSWD") @ ResponseBody public string update PSWD () Here I want to call above the controller method and I want to update that user password. How can I return it ""; } Anyone helps me
You never put a business logic in the controller, and less business logic related to the database, the transaction class / Method should be in service level. But if you need to redirect any other controller method, use the redirect
@RequestMapping (value = "/ updatePSWD") @ResponseBody public string update (pswd) {"redirect : /getUser.do "; }
Comments
Post a Comment