Snippets tagged “spring-mvc”
5 snippets use this tag.
- @RequestParam vs @PathVariableJava
In Spring MVC, the @RequestParam annotation is used to bind a request parameter to a method parameter.
- How to respond with an HTTP 400 error in a Spring MVC @ResponseBody method returning StringJava
To respond with an HTTP 400 error in a Spring MVC controller method that returns a String, you can throw a ResponseStatusException with a status of BAD_REQUEST.
- Redirect to an external URL from controller action in Spring MVCJava
To redirect to an external URL from a controller action in Spring MVC, you can use the RedirectView class and return it from the controller action.
- Spring MVC - How to return simple String as JSON in Rest ControllerJava
To return a simple string as JSON in a Spring MVC Rest Controller, you can use the @ResponseBody annotation and return the string directly.
- What is @ModelAttribute in Spring MVC?Java
In Spring MVC, the @ModelAttribute annotation is used to bind request parameters to method arguments in controller methods.