SPRINGMVC a list within the pass parameter

Source: Internet
Author: User

Finally, using AJAX to commit successfully, here are some code, if there is time to refine.


function Test () {
$.ajax ({
Type: "POST",
URL: "Test2",
ContentType: "Application/json",
Data: ' {' proptest ': ' Test ', ' list ': [{' Prop1 ': ' A '},{' Prop1 ': ' B '}]} ',
DataType: "JSON",
Success:function (data) {
Console.log (data);


@RequestMapping (value= "/test2", Method=requestmethod.post)
Public String Hello2 (@RequestBody testlist test) {
Value= "/hello/{id}",
@PathVariable (value= "id") Integer ID,
@RequestParam (value= "username") String username
Return Testbiz.gettest (1L);

Spring Configuration:

<bean id= "Mappingjacksonhttpmessageconverter"
class= "Org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" >
<property name= "Supportedmediatypes" >

Bean Information:

Public class Testlist {
    private String proptest;
    public String getproptest () {
        return proptest;

    public void Setproptest (String proptest) {
         this.proptest = proptest;

    private list<testinner> List;

    public list<testinner> getList () {
        return List;

    public void setlist (list<testinner> List) {
        this.list = list;

public class Testinner {
Private String Prop1;

Public String GetProp1 () {
return PROP1;

public void SetProp1 (String prop1) {
THIS.PROP1 = Prop1;

SPRINGMVC a list within the pass parameter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.