Currently the application I am working on throws 404 error while using custom path.




@Controller @RequestMapping(value = "/orderconfirmation") public class OrderConfirmationController {

.... .... ...

@RequestMapping(value = "{TId}",method = RequestMethod.GET) public String getOrderConfirmation(@PathVariable String TId, Model model) { .... some code here ... model.addAttribute("transaction",transaction); return "orderconfirmation"; }

... ... ...



It triggers the controller as during debug I can go through the controller. But after completion it throws 404 error. Any idea?

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

answered by (171 points)
0 votes

I guess batter option for you is to pass TId as URL parameters as below.


http://localhost/..yourwebapp../orderconfirmation?TId={your tid here}.


You can read in controller as given below.


@RequestMapping(method = RequestMethod.GET)
public String getOrderConfirmation(@RequestParam(value = "TId") String TId, Model model) {

//... ... ...