0
而下面的方法只有'名稱'地圖的關鍵是作爲迴應..... 爲什麼價值地圖是ArrayList的不響應未來雖然在Java球衣api中使用地圖<String,Arraylist <String>>,它只是給出地圖的關鍵字,即字符串
端點mehtod的是如下
public LoginResponse LoginUserJSON(LoginRequestVO requestVOLogin)
{
LoginResponse lr = new LoginResponse();
Map<String, ArrayList<String>> mapObj = new
HashMap<String,ArrayList<String>>();
ArrayList<String> loginRequestVOs = new ArrayList<>();
lr.setStatus("Done");
loginRequestVOs.add("parth1");
loginRequestVOs.add("parth2");
mapObj.put("name", loginRequestVOs);
lr.setRequestData(mapObj);
System.out.println(mapObj);
return lr;
}
responsevo是如下
@XmlRootElement(name= "Response")
@XmlAccessorType(XmlAccessType.FIELD)
public class LoginResponse
{
@XmlElement(name = "status")
String status;
@XmlElement(name = "requestData")
private Map<String, ArrayList<String>> requestData;
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public Map<String, ArrayList<String>> getRequestData()
{
return requestData;
}
public void setRequestData(Map<String, ArrayList<String>> requestData)
{
this.requestData = requestData;
}
}