Required request body is missing: public org.springframework.web.servlet.ModelAndView
<p>I inquire how to send information from local storage to spring, there was no answer <a href="https://stackoverflow.com/questions/38827432/send-array-from-local-storage-to-spring">https://stackoverflow.com/questions/38827432/send-array-from-local-storage-to-spring</a>, so i tried to do in that way and the new problems appeared
As of now JS it looks like :</p>

<pre><code>function sendToJavaBuy() {
    cartWhisky = JSON.parse(localStorage.getItem("shoppingCart"));
    var newArray = [];
    var i = 0;
    for(i in cartWhisky){
        newArray[i] = cartWhisky[i].name +"_"+ cartWhisky[i].quantity;
        i++;
        console.log("newArray[i]"+newArray);

    }
        $.ajax({
            headers: {
                "Accept": "application/json",
                "Content-Type": "application/json"
            },
            type: "POST",
            data :
                JSON.stringify(newArray),
            url: 'buySuccessfulWhisky',

            success: function (msg) {
                window.location.href = "buySuccessfulWhisky";
                //console.log(data)
            }
        });
 }
</code></pre>

<p>Java:</p>

<pre><code>  @RequestMapping(value = "buySuccessfulWhisky", method ={RequestMethod.GET, RequestMethod.POST})
    public ModelAndView view(@RequestBody List&lt;String&gt; newArray) {
        System.out.println(newArray);
        System.out.println();
        for(String properties:newArray) {
            String[] split = properties.split("_");
            String name = split[0];
            Integer quantity = Integer.valueOf(split[1]);
            System.out.println("name:= "+name);
            System.out.println("quantity:= "+quantity);

//        whiskyService.changeInfoInDB(name, quantity);
        }
        List&lt;WhiskyDTO&gt; whiskyDTOs =whiskyService.seeAllWhisky();
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("viewAvailableWhisky", whiskyDTOs);
        modelAndView.setViewName("whisky");
        return modelAndView;
    }
   }
</code></pre>

<p>I see an exception on the UI:
I read forum, but can't understand what can I do with this mistake.</p>

<blockquote>
  <p>Whitelabel Error Page</p>
  
  <p>This application has no explicit mapping for /error, so you are seeing
  this as a fallback.</p>
  
  <ul>
  <li>Tue Aug 09 12:11:39 EEST 2016 There was an unexpected error (type=Bad    Request, status=400). Required request body is missing:
  public    org.springframework.web.servlet.ModelAndView<br>
  com.example.controller.buy.SuccessfulBuyWhiskey.view(java.util.List)</li>
  </ul>
</blockquote>

<p><a href="https://i.stack.imgur.com/OaVBB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OaVBB.jpg" alt="enter image description here"></a></p>

<p>maybee I have problems, becouse of this:
I do table to HTML from JS</p>

<pre><code>var cartArray = listCart();
var table ='';
displayShow();

function displayShow() {
    table = '';
    for(var r in cartArray){
        table +='&lt;tr&gt;&lt;td width="50"&gt;&lt;img src="' + cartArray[r].photo + '" width=35 height=80&gt;&lt;/td&gt;\
        &lt;td width="100"&gt;'+cartArray[r].name+'&lt;/td&gt;\
        &lt;td width="150"&gt;'+cartArray[r].describe+'&lt;/td&gt;\
        &lt;td width="100"&gt;\
        &lt;table width="80"&gt;&lt;td align="right"&gt;&lt;button class="minus" data-name="'+cartArray[r].name+'"&gt;-&lt;/button&gt;&lt;/td&gt;\
        &lt;td align="center"&gt; '+cartArray[r].quantity +'&lt;/td&gt;\
        &lt;td align="left"&gt;&lt;button class="plus" data-name="'+cartArray[r].name+'"&gt;+&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;\
        &lt;/td&gt;\
            +&lt;td width="50" align="center"&gt;'+cartArray[r].price+'&lt;/td&gt;\
            +&lt;td width="80"&gt;' + cartArray[r].total + '&lt;/td&gt;\
            +&lt;td width="50"&gt;&lt;button class="deleteItem" data-name="'+cartArray[r].name+'"&gt;X&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt;';
    }
    $('#trash').html(table);
    $("#totalCart").html(totalPriceInCart());
}
</code></pre>