I have a class which has multiple controller in it and from one of the controller i want to call another controller which is in different class and when the particular controller is called that controller will create the view.
my codes are
class one // class from which controller will be called
@Controller
@RequestMapping(value="/register")
public class PatientController {
@RequestMapping(value="/demo1", method=RequestMethod.GET)
public String demo1(){
System.out.println("Demo1 method.....");
return "redirect:user/dashboard";
}
}
Class second // controller of this class to be called
@Controller
@RequestMapping("/user")
public class UserDasboardController {
@RequestMapping(value="/dashboard", method=RequestMethod.GET)
public String get(ModelMap model){
return "userdashboard";// returning view
}
}
after the first controller is called gives url as ".../register/user/dashboard"
however it should give url as"..../user/dashboard".
please suggest how can I achieve this. Or there is any other way of doing same thing.