I am trying to create different response with same mapping. The only difference will be the argument passed in the url.
For example,
http://localhost/manageuser?adduser=test
http://localhost/manageuser?deleteuser=test
I tried with the below approach
@Controller
@RequestMapping("/manageuser")
public class ManageUserController {
@ResponseStatus(value = HttpStatus.OK)
protected void deleteUser(@RequestParam("deleteuser") String user) {
System.out.println(user);
}
@ResponseStatus(value = HttpStatus.OK)
protected void addUser(@RequestParam("addUser") String user) {
System.out.println(user);
}
}
I wasn't able to get it working properly. I am not sure if my approach is correct. What mistake am I making here?
Aucun commentaire:
Enregistrer un commentaire