Page submission string array and List Object collection example

Source: Internet
Author: User

Ajax form Submission $.ajax ({                cache:true,          &NBSP ;     Type: "POST",                url:ajaxcallurl,      &N Bsp         data:$ (' #yourformid '). Serialize (),//Your formid                async:false,                error:function (request) {    &NBSP ;               alert ("Connection error");            &NBSP ;  },                success:function (data) {        &NBS P           $ ("#commonLayout_appcreshi"). Parent (). HTML (data);          & nbsp    }           }); The fields in the form correspond to the  name not the ID normal submission form: Add a id,<form id= directly in the form form. FormId "></form&gt, get a buttom button to commit, add a onclick= "JS function", and then in the JS function $ ("#formId"). Submit (); Just ok. =========================.

Following the data binding of multiple objects in the previous Springmvc page, this article mainly describes the implementation of data binding for complex type objects, such as the addition of the parent object Courseinfo in the previous article: string[] times, list<student> Studentlist these two complex type properties, how can the data in the page be bound exactly to the object?

Reference Source: http://www.360doc.com/content/16/1022/15/37520906_600479377.shtml

Class

public class Courseinfo {
Private Course Course;
Private Teacher Teacher;
private string[] times;
Private list<student> studentlist;
}

public class Student extends IdEntity {
private String name;
Private String Email;
Private String ClassName;
}

Page

1<form:form id= "Input-form" modelattribute= "Courseinfo"2action= "${ctx}/demo/course.do?method=save" method= "POST" >3<input type= "hidden" name= "id" value= "${course.id}"/>4<fieldset class= "Prepend-top" >5<legend> Course Information </legend>6<div id= "MessageBox" class= "error-msg" style= "Display:none" > incorrect input, please correct it first. </div>7<div>8<label for= "Course.name" class= "field" > Course name:</label>9<inputTenType= "text" id= "Course.name" name= "Course.name" size= "20" OneValue= "${courseinfo.course.name}" class= "required"/> A</div> -<div> -<label for= "Course.description" class= "field" > Course Introduction:</label> the<input -Type= "text" id= "course.description" name= "Course.description" -Size= "value=" ${courseinfo.course.description} "class=" required "/> -</div> +  -<div> +<label for= "Teacher.name" class= "field" > Teacher name:</label> A<input atType= "text" id= "Teacher.name" name= "Teacher.name" size= "20" -Value= "${courseinfo.teacher.name}" class= "required"/> -</div> -<div> -<label for= "Teacher.email" class= "field" > Teacher email:</label> -<input inType= "text" id= "Teacher.email" name= "Teacher.email" size= "20" -Value= "${courseinfo.teacher.email}" class= "required"/> to</div> +<div> -<label for= "Times" class= "field" > Class:</label> the<input type= "text" id= "times[0]"name= "Times"Size= "value=" Monday "class=" required "/> *<input type= "text" id= "times[1]"name= "Times"Size= "value=" Wednesday "class=" required "/> $<input type= "text" id= "times[2]"name= "Times"Size= "value=" Friday "class=" required "/>Panax Notoginseng</div> -  the<div> +<label for= "Studentlist[0].name" class= "field" > Student 1 Name:</label> A<input type= "text" id= "Studentlist[0].name"name= "Studentlist[0].name"Size= "value=" Student 1 Name "class=" required "/> the</div> +<div> -<label for= "Studentlist[0].email" class= "field" > Student 1email:</label> $<input type= "text" id= "Studentlist[0].email"name= "Studentlist[0].email"Size= "value=" Student 1Email "class=" required "/> $</div> -<div> -<label for= "Studentlist[1].name" class= "field" > Student 2 name:</label> the<input type= "text" id= "Studentlist[1].name"name= "Studentlist[1].name"Size= "value=" Student 2 Name "class=" required "/> -</div>Wuyi<div> the<label for= "Studentlist[1].email" class= "field" > Student 2email:</label> -<input type= "text" id= "Studentlist[0].email"name= "Studentlist[1].email"Size= "value=" Student 2Email "class=" required "/> Wu</div> -</fieldset>

Page submission string array and List Object collection example

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.