Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

1 like 0 dislike
2.4k views
in Programming by
retagged by
Currently the application I am working on throws 404 error while using custom path.

 

e.g.

 

@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?

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)

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) {

//... ... ...

}


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...