Time for action – implementing RESTful web services
We are going to add a shopping cart facility in two phases. Firstly, we will create a REST-style controller to handle all shopping-cart-related web requests. Secondly, we will add some JavaScript code to render the JSON data returned by the REST web service controller. First, let's implement some RESTful web services using Spring MVC controllers so that later we can add some JavaScript code to consume those web services.
- Create a domain class named
CartItem
under the packagecom.packt.webstore.domain
in the source foldersrc/main/java
; then, add the following code to it:package com.packt.webstore.domain; import java.math.BigDecimal; public class CartItem { private Product product; private int ...
Get Spring MVC Beginner’s Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.