3

In PHP there is the possibility to recognize a parameter in the address bar by passing it in the controller's method ; for example :

http://192.168.2.49/papsp/index.php/meeting/modif/3

In this example the data 3 is taken as parameter value for the meeting controller's method modif :

public modif($key) { ... }

So how to proceed analogically in Spring ?

1 Answer 1

6

You need to use the @RequestMapping annotation, along with @PathVariable with your method param. And your url will be like this /meeting/modif/{key}.

Here's how should be your code:

@RequestMapping(value = "/meeting/modif/{key}", method = RequestMethod.POST)
public void modif(@PathVariable int key) {
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.