我有一个bean,我正在填充并设置在servlet中的HashMap中:
HashMap<String, Object> masterBeanMap = new HashMap<String, Object>();
for (Map.Entry<String, Object> entry : masterMap.entrySet()) {
String key = entry.getKey();
masterBean.setAccountID(keyArray[0]);
masterBean.setPropertyID(keyArray[1]);
masterBean.setProfileID(keyArray[2]);
masterBean.setReportName(childFile);
masterBeanMap.put(key, masterBean);
}
为了简洁起见,我只展示了必要的代码片 在我的jsp中:
<c:forEach items="${masterBeanMap}" var="masterBeanMap">
<tr>
<td>${masterBeanMap.value.getAccountID()}</td>
<td>${masterBeanMap.value.getPropertyID()}</td>
<td>${masterBeanMap.value.getProfileID()}</td>
<td>${masterBeanMap.value.getReportName()}</td>
<td>${masterBeanMap.key}</td>
</tr>
</c:forEach>
我的豆子:
public class GAMasterBean {
String accountID;
String propertyID;
String profileID;
String reportName;
/**
* @return the accountID
*/
public String getAccountID() {
return accountID;
}
/**
* @param accountID the accountID to set
*/
public void setAccountID(String accountID) {
this.accountID = accountID;
}
/**
* @return the propertyID
*/
public String getPropertyID() {
return propertyID;
}
/**
* @param propertyID the propertyID to set
*/
public void setPropertyID(String propertyID) {
this.propertyID = propertyID;
}
/**
* @return the profileID
*/
public String getProfileID() {
return profileID;
}
/**
* @param profileID the profileID to set
*/
public void setProfileID(String profileID) {
this.profileID = profileID;
}
/**
* @return the reportName
*/
public String getReportName() {
return reportName;
}
/**
* @param reportName the reportName to set
*/
public void setReportName(String reportName) {
this.reportName = reportName;
}
对于key =“38058226_66591454_12345”和“38058226_66591454_123456”,我设置了bean,但是在jsp中提取时,我只获取了密钥“38058226_66591454_123456”的数据。我哪里错了......