Suppose, in your service class, you have list of accountIds like this(假设在您的服务类中,您具有诸如此类的accountId列表)
ArrayList<Integer> accountIdList = new ArrayList<>();
accountIdList.add(1);
accountIdList.add(2);
accountIdList.add(3);
& you have added this list into HTTP Session object for further use like(&您已将此列表添加到HTTP Session对象中,以供进一步使用,例如)
session.setAttribute("accountIds",accountIdList);
In your JSP, you can then use JSTL for-each loop
to create dynamic buttons & textboxes as below(然后,在您的JSP中,可以使用JSTL for-each loop
创建动态按钮和文本框,如下所示)
<c:forEach var="ids" items="${session.accountIds}" varStatus="loop">
<input type="text" name="role${loop.index}" />
<input type="submit" value="<c:out value=${ids} />" />
</c:forEach>
I hope this helps.(我希望这有帮助。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…