apache的jstl的forEach的問題,好像不是很好用

escape發表於2005-06-20


class Customer {
private String firstName;
public void setFirstName(String firstName) {
this.firstName = firstName;
}

public String getFirstName() {
return this.firstName;
}
}

List customers = new ArrayList();
Customer one = new Customer();
one.setFirtName("clh");
Customer two = new Customer();
one.setFirtName("mds");
customers.add(one);
customers.add(two);
jsp中:
session.setAttribute("customers", customers);
<c:forEach var="customer" items="${customers}">
<c:out value="${customer.firstName}" />
</c:forEach>
這是會出現:得不到firstName屬性的錯誤,搞了半天沒搞明白是怎麼回事,請大家幫幫忙。謝謝。

相關文章