Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Spring MVC

Gerrit Meier
September 11, 2014

Spring MVC

Spring MVC as a part of the Spring ecosystem.

Gerrit Meier

September 11, 2014
Tweet

More Decks by Gerrit Meier

Other Decks in Programming

Transcript

  1. WebMVC @Controller public class UserController { ! @RequestMapping("/users") public String

    listUsers() { […] return "viewName"; } } http://server/myApp/users
  2. WebMVC @Controller @RequestMapping("/users") public class UserController { ! @RequestMapping public

    String listUsers() { […] return "viewName"; } } http://server/myApp/users
  3. WebMVC @Controller public class UserController { ! @RequestMapping("/users") public String

    listUsers( @RequestParam("filter") String filter) { […] return "viewName"; } } http://server/myApp/users?filter=hans
  4. WebMVC @RequestMapping( value = "/users/{id}", method = RequestMethod.GET) public String

    showUser( @PathVariable("id") Long id){ […] return "viewName"; } http://server/myApp/users/1
  5. WebMVC @RequestMapping(method = RequestMethod.POST) public String save( @Valid User user,

    BindingResult bindingResult) { […] return "viewName"; } POST http://server/myApp/users
  6. WebMVC Accept: text/html ! ! ! ! ! Accept: application/json

    /users { users: [ {name: “Hans“} ] } User List ! - Hans http://…