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
-
Make
edu.train.product.InventoryControllera spring controller -
Map InventoryController to the request path "/inventory" (class request mapping)
-
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
- Start the training application and go to the app home page
- Click on the link 'Ex 14 Get Products'. Verify you get the result: "You invoked controller method: All Products"
- Click on the link 'Ex 14 Add Product'. Verify you get the result: "You invoked controller method: Add Product"
- Click on the link 'Ex 14 Delete Product'. Verify you get the result: "You invoked controller method: Delete Product"