当我尝试在 jsp 的 el 表达式中使用对象的属性时,会生成 PropertyNotFound 异常。以下是我的代码:
public class Pledges {
private Integer amount;
private String creward;
// proper getter setter
.............................
ArrayList<Pledges> pledges ;
pledges = entry.getPledges();
request.setAttribute("pledges", pledges);
............................
<c:forEach items=" ${pledges}" var="pledge">
<input type='radio' name='rewards' id='r1' value='Option 1' />
<label for='r1'>${pledge.creward}
</label> <br /> <br />
</c:forEach>
jsp页面中会抛出以下异常:
javax.el.PropertyNotFoundException:在 java.lang.String 类型上找不到属性“creward”