2019獨角獸企業重金招聘Python工程師標準>>>
bean 類型 ?如下
1. json 字符串
?? ??? ??? ?$.ajax({
?? ??? ??? ? ? ? ? ?url :'${ctx}/test/testData/f1?book=java',
?? ??? ??? ? ? ? ? ?type: 'post',
?? ??? ??? ? ? ? ? ?dataType : "json",
?? ??? ??? ? ? ? ? contentType:'application/json;charset=UTF-8',//關鍵是要加上這行
?? ??? ??? ? ? ? ? data : JSON.stringify( {id:'22',remarks:'aaa',father:{id:'333',remarks:'bbb'}}),
?? ??? ??? ? ? ? ? ?async : false, // 同步請求
?? ??? ??? ? ? ? ? ?success : function(data) {
?? ??? ??? ? ? ? ? ? ? ? debugger ;
?? ??? ??? ? ? ? ? ?}
?? ??? ??? ? ? ?});后臺代碼:
public String f1( @RequestBody User u,
2.json 對象 ?
?? ??? ??? ?$.ajax({
?? ??? ??? ? ? ? ? ?url :'${ctx}/test/testData/f2?book=java',
?? ??? ??? ? ? ? ? ?type: 'post',
?? ??? ??? ? ? ? ? ?dataType : "json",
?? ??? ??? ? ? ? ? ?data : {id:'22',remarks:'aaa','father.id':'333','father.remarks':'bbb'},
?? ??? ??? ? ? ? ? ?async : false, // 同步請求
?? ??? ??? ? ? ? ? ?success : function(data) {
?? ??? ??? ? ? ? ? ? ? ? debugger ;
?? ??? ??? ? ? ? ? ?}
?? ??? ??? ? ? ?});public String f2( User u,
?
?
?
?
?? ?private static final long serialVersionUID = 1L;
?? ?private String id;
?? ?private String remarks;
?? ?
?? ?private ?User ?father;
?? ?
?? ?public String getId() {
?? ??? ?return id;
?? ?}
?? ?public void setId(String id) {
?? ??? ?this.id = id;
?? ?}
?? ?public String getRemarks() {
?? ??? ?return remarks;
?? ?}
?? ?public void setRemarks(String remarks) {
?? ??? ?this.remarks = remarks;
?? ?}
?? ?public User getFather() {
?? ??? ?return father;
?? ?}
?? ?public void setFather(User father) {
?? ??? ?this.father = father;
?? ?}