0
假設我有一個業務主鍵編號列表和OrderId編號的java Map到訂單。我將如何檢索訂單對象?Struts 2嵌套參數問題
Action Form
// assume proper getters and setters and that both objects are initialized
private List<CustomerOrders> orders;
private Map<Integer, Order> orderIdMap;
// JSP
<s:iterator value="orders">
<s:property value="%{orderIdMap['what_goes_here'].orderDate}" />
</s:iterator>
在「what_goes_here」空白,我已經試過如下:
%{orders.orderId}
%{orderId}
<s:property value="%{orders.orderId}" />
<s:property value='%{orders.orderId}' />
我也試了一下沒有what_goes_here之前的單引號,它也不能工作。
那麼,我如何使用作爲訂單列表的當前索引的鍵訪問Map中的值?
謝謝!
是'orderId'意思是'CustomerOrders'對象或訂單列表中的當前索引的屬性? – nmc 2011-06-16 21:51:37