title: Can not deserialize value of type int from String
body: <p>This is the full error that I get in the console: </p>
  
  <blockquote>
    <p>"Could not read document: Can not deserialize value of type int from
    String "${product.id}": not a valid Integer value↵ at [Source:
    java.io.PushbackInputStream@40d1a098; line: 1, column: 14] (through
    reference chain: haughton.dvdstore.model.AddToCartPojo["productId"]);
    nested exception is
    com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not
    deserialize value of type int from String "${product.id}": not a valid
    Integer value↵ at [Source: java.io.PushbackInputStream@40d1a098; line:
    1, column: 14] (through reference chain:
    haughton.dvdstore.model.AddToCartPojo["productId"])"</p>
  </blockquote>
  
  <p>My html</p>
  
  <pre><code>&lt;form  method="post"&gt;
  &lt;p&gt;Enter quantity you would like to purchase :
  &lt;input type="number" id="quantity" name="quantity" step="any" min="1" max="${product.quantityInStock}" value="1"&gt;&lt;/input&gt;
   &lt;/p&gt;
  &lt;input type="submit" class="btn btn-primary"  id="addToCart"  name="button" value="Add to cart"/&gt;
  &lt;input type="hidden" id="productId" value='${product.id}'/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>App.js</p>
  
  <pre><code>  $("#addToCart").click(function(event) {
  
          var data = {}
          data["productId"] = $("#productId").val();
         data["quantity"] = $("#quantity").val();
  
  
  
          $.ajax({
                   type: "POST",
                   contentType: "application/json",
                   url: "http://localhost:8080/addToCart",
                   data: JSON.stringify(data),
                   dataType: 'json',
                   timeout: 600000,
                   success: function (data) {
                      console.log(data);
                       //...
                   },
                   error: function (e) {
  
                       //...
                   }
          });
       event.preventDefault();
  
      });
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>@Controller
  @Scope("session")
  public class CartController {
  @Autowired
  private Cart cart;
  @Autowired
  ProductService productService;
  
  @RequestMapping(value="/cart", method= RequestMethod.GET)
  public String searchResults(Model model) {
  model.addAttribute("cartLines",cart.getLines());
  model.addAttribute("cartTotalPrice",cart.getTotalPrice());
      return "cart";
  }
  @ResponseBody
  @RequestMapping(value="/addToCart", method= RequestMethod.POST)
  public String searchResults(@RequestBody AddToCartPojo addToCartPojo) {
      Product product = productService.findById(((long) addToCartPojo.getProductId()));
      if(product == null){
          //if the productid supplied doesnt belong to a product in our database
          return "failure";
      }
      FlashMessage result = cart.add(product,addToCartPojo.getQuantity());
        return  result.getStatus().toString();
  }
  </code></pre>
  
  <p>AddToCartPojo</p>
  
  <pre><code>//pojo for sending via ajax
  public class AddToCartPojo {
  private int productId;
  private int quantity;
  
  public int getProductId() {
      return productId;
  }
  
  public void setProductId(int productId) {
      this.productId = productId;
  }
  
  public int getQuantity() {
      return quantity;
  }
  
  public void setQuantity(int quantity) {
      this.quantity = quantity;
  }
  </code></pre>
  
  <p>}</p>