gpt4 book ai didi

java - JSTL 找不到 forEach 迭代的 bean

转载 作者:行者123 更新时间:2023-12-01 12:06:54 24 4
gpt4 key购买 nike

我有这些对象的集合:

public class Selection
{
private List<Option> options = new ArrayList<Option>();

... getter /setter ...
}

在我的 JSP 中我这样做:

<c:forEach var="selection" items="${selections}">

... numerous uses of selection that work fine ...

<html:select name="selection" property="option"
indexed="true" styleId="option_${selection.option.id}"
title="Option" styleClass="reasonsel"
disabled="false" >
<html:options collection="selection.options" property="id" labelProperty="description"/>
</html:select>
</c:forEach>

我得到:

javax.servlet.jsp.JspException:无法在任何范围内找到 bean:“selection.options”

我已在调试器中确认选择对象存在并且具有选项。

最佳答案

<html:options collection="${selection.options}" property="id" labelProperty="description"/>

您应该使用 el 标签来检索其值。

关于java - JSTL 找不到 forEach 迭代的 bean,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27530441/

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