Welcome to the Question and Answer site for Software Testing Professionals

You can get your queries resolved from Software Testing Professionals.

Ask a Question

Get answers and give answers to questions from other members.

View All Questions

Get votes and earn points to build your reputation in community.

View Hot Questions

1
404 error while using Spring-boot RequestMapping with PathVariable

Open 1 Answers 146 Views Programming
1 1

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
0

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

//... ... ...

}

answered by (192 points)

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.

We have resolved 1.2k+ Software Testing queries!

Software Testing Board Weekly update

We will send you handpicked questions that you would love to answer.

View previous campaigns.

Top Contributors

...