gpt4 book ai didi

java - Struts逻辑:iterate over list of lists

转载 作者:行者123 更新时间:2023-12-01 13:50:22 25 4
gpt4 key购买 nike

我正在尝试迭代一个具有另一个类作为成员变量的类。以下是该类的一些代码:

public class UnregisteredCaseRecipient extends Auditable {

private String peoplePin;
private String recipName;
private String roleCd;
private String secLvl;
private List<UnregisteredCaseRecipientNotification> unregisteredCaseRecipientNotifications;

我尝试过的JSP代码如下:

                        <logic:iterate name="caseRecip" id="unregisteredCaseRecipientNotifications">
<td style="width: 25px;">
<input type="checkbox" name="docRecipNotify" id="docRecipNotify" value="${unregisteredCaseRecipientNotifications.id}" ${unregisteredCaseRecipientNotifications.notificationCheck}/>
</td>
</logic:iterate>

我尝试过类似this的东西没有运气。

<nested:iterate id="unregisteredRecipients" name="crFilingServiceListForm" property="unregisteredCaseRecipients" >
<nested:iterate id="unregisteredCaseRecipientNotifications" name="unregisteredRecipients">
<td style="width: 25px;">notify: ${unregisteredCaseRecipientNotifications.notify} id: ${unregisteredCaseRecipientNotifications.id}
<input type="checkbox" name="docRecipNotify" id="docRecipNotify" value="${unregisteredCaseRecipientNotifications.id}" ${unregisteredCaseRecipientNotifications.notificationCheck}/>
</td>
</nested:iterate>
</nested:iterate>

我也尝试过类似 this 的东西没有运气。

                        <logic:iterate name="crFilingServiceListForm" property="${caseRecip.unregisteredCaseRecipientNotifications" id="caseRecipNotify" indexId="j">
<td style="width: 25px;">
<input type="checkbox" name="docRecipNotify" id="docRecipNotify" value="${caseRecipNotify.id}" ${caseRecipNotify.notificationCheck}/>
</td>
</logic:iterate>

谢谢

汤姆

最佳答案

我可以通过使用嵌套 for 来实现此功能:

<c:forEach items="${crFilingServiceListForm.unregisteredCaseRecipients}" var="unregisteredRecip">
<c:forEach items="${unregisteredRecip.unregisteredCaseRecipientNotifications}" var="unregisteredNotification">
<td style="width: 25px;">
<input type="checkbox" name="docRecipNotify" id="docRecipNotify" value="${unregisteredNotification.id}" ${unregisteredNotification.notificationCheck}/>
</td>
</c:forEach>
</tr>
</c:forEach>

感谢大家的帮助!

汤姆

关于java - Struts逻辑:iterate over list of lists,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20011072/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com