Struts 2 嵌套参数问题
假设我有一个业务主键编号列表和一个 OrderId 编号到订单的 java Map。我如何检索订单对象?
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 中的值呢?
谢谢!
Suppose that I have a list of business primary key numbers and a java Map of OrderId numbers to Orders. How would I retrieve the order object?
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>
In the "what_goes_here" blank, I've tried the following:
%{orders.orderId}
%{orderId}
<s:property value="%{orders.orderId}" />
<s:property value='%{orders.orderId}' />
I also tried it without the single quotes before what_goes_here and it didn't work either.
So how do I access the value from the Map using the key which is the current index of the orders list?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是未经测试的,但尝试类似的东西
This is untested but try something like