Exercise 14: Controllers and Request Mappings - jkneal/spring-angular-train GitHub Wiki

Goals

Learn how to create controller classes and map controller methods to requests.

Instructions

  1. Make edu.train.product.InventoryController a spring controller

  2. Map InventoryController to the request path "/inventory" (class request mapping)

  3. Now map the following controller methods to the specified path and Http method:

Method Path Http Method
getAllProducts "/inventory" Get
addProducts "/inventory/add" Post
deleteProduct "/inventory/delete" Post

VERIFICATION

  1. Start the training application and go to the app home page
  2. Click on the link 'Ex 14 Get Products'. Verify you get the result: "You invoked controller method: All Products"
  3. Click on the link 'Ex 14 Add Product'. Verify you get the result: "You invoked controller method: Add Product"
  4. Click on the link 'Ex 14 Delete Product'. Verify you get the result: "You invoked controller method: Delete Product"