Reputation: 460
I am trying to call a method inside a method. Both the methods are present inside same controller.
Here is my first method
@RequestMapping(value="/getDonationDetails" , method={RequestMethod.GET,RequestMethod.POST})
public String getDonationDetails() throws IOException {
return "redirect:/getPaymentDetails? msg=msg";
}
Here is getPaymentDetails method
@RequestMapping(value="/getPaymentDetails", method={RequestMethod.GET, RequestMethod.POST})
public String getPaymentDetails(@PathVariable String msg){
System.out.println("message is" + msg);
return "success";
}
Both methods are present inside same controller. But I am not able to call getPaymentDetails method. Can anyone tell how to call getPaymentDetails method from getDonationDetails method?
Upvotes: 2
Views: 4379
Reputation: 9612
You don't need to redirect. You can just call the method:
@RequestMapping(value="/getDonationDetails" , method={RequestMethod.GET,RequestMethod.POST})
public String getDonationDetails() throws IOException {
return getPaymentDetails("msg");
}
Upvotes: 4