jsp文件
数组:
<s:textfield name="ages" value="a1"></s:textfield>
<s:textfield name="ages" value="a2"></s:textfield>
<s:textfield name="ages" value="a3"></s:textfield>
<s:textfield name="names[0]" value="n1"></s:textfield>
<s:textfield name="names[1]" value="n2"></s:textfield>
<s:textfield name="names[2]" value="n3"></s:textfield>
List:
<s:textfield name="lastName[0]" value="11"></s:textfield>
<s:textfield name="lastName[1]" value="21"></s:textfield>
<s:textfield name="lastName[2]" value="31"></s:textfield>
Map
<s:textfield name="maid.mary"></s:textfield>
<s:textfield name="maid['beth']"></s:textfield>
java文件
System.out.println(ages.toString()+names.toString()+getLastName().toString());
Map map = getMaid();
System.out.println(map.get("mary")+":"+map.get("beth"));
/*数组*/
private String[] ages;
/**
* @return the ages
*/
public String[] getAges() {
return ages;
}
/**
* @param ages the ages to set
*/
public void setAges(String[] ages) {
this.ages = ages;
}
private String[] names = new String[10];
/**
* @return the names
*/
public String[] getNames() {
return names;
}
/**
* @param names the names to set
*/
public void setNames(String[] names) {
this.names = names;
}
private List<Integer> lastName;
/**
* @return the lastName
*/
public List<Integer> getLastName() {
return lastName;
}
/**
* @param lastName the lastName to set
*/
public void setLastName(List<Integer> lastName) {
this.lastName = lastName;
}
private Map maid;
/**
* @return the maid
*/
public Map getMaid() {
return maid;
}
/**
* @param maid the maid to set
*/
public void setMaid(Map maid) {
this.maid = maid;
}