第一种:map取值
//查询所有可能性
Map<String,Object> map = new HashMap<>();
for(TransactionHistory history:historyList){
String stageName = history.getStage();
String value = (String) this.getServletContext().getAttribute(stageName);
map.put(stageName, value);
}
request.setAttribute("possibilityMap", map);
<c:forEach items="${possibilityMap }" var="map">
<c:if test="${hl.stage==map.key }">
<td>${map.value }</td>
</c:if>
</c:forEach>
第二种:list取值
TransactionHistoryService historyService = (TransactionHistoryService)ServiceFactory
.getServiceProxy(new TransactionHistoryServiceImpl());
List<TransactionHistory> historyList = historyService.queryAllTransactionHistoryByTransactionId(id);
request.setAttribute("historyList", historyList);
<c:if test="${!empty historyList }">
<c:forEach items="${historyList }" var="hl">
<tr>
<td>${hl.stage }</td>
<td>${hl.amountOfMoney }</td>
<td>${hl.expectedClosingDate }</td>
</tr>
</c:forEach>
</c:if>
第三种:实体类取值
// 查询交易基本信息
TransactionService tranService = (TransactionService)ServiceFactory
.getServiceProxy(new TransactionServiceImpl());
Transaction transaction = tranService.detailTransaction(id);
request.setAttribute("transaction", transaction);
<h3>${transaction.name } <small>¥${transaction.amountOfMoney }</small></h3>
第四种:单个数据取值
//查询交易基本表的可能性
String possibility = (String) this.getServletContext().getAttribute(transaction.getStage());
request.setAttribute("possibility", possibility);
<b>${possibility }</b>