一、Java後端Action及對象後端
public class HomeAction {
private Room room;瀏覽器
/**
* @return the room
*/
public Room getRoom() {
return room;
}this
/**
* @param room the room to set
*/
public void setRoom(Room room) {
this.room = room;
}
}.net
class Room{
String number;
List<User> users;
/**
* @return the number
*/
public String getNumber() {
return number;
}
/**
* @param number the number to set
*/
public void setNumber(String number) {
this.number = number;
}
/**
* @return the users
*/
public List<User> getUsers() {
return users;
}
/**
* @param users the users to set
*/
public void setUsers(List<User> users) {
this.users = users;
}
}對象
class User{
String name;
String age;
List<String> phone;
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the age
*/
public String getAge() {
return age;
}
/**
* @param age the age to set
*/
public void setAge(String age) {
this.age = age;
}
/**
* @return the phone
*/
public List<String> getPhone() {
return phone;
}
/**
* @param phone the phone to set
*/
public void setPhone(List<String> phone) {
this.phone = phone;
}
}get
二、http請求看到的格式以下,用F12觀察瀏覽器io
room.number='1233';
room.users[0].name='my name is jcc';
room.users[0].age='25';
room.users[0].phone[0]='15528052635';
class
只有這種格式後臺才能接收到嵌套對象及List值後臺