maveganzones
Feb 7th, 2006, 04:40 AM
Hi all.
I have a class named "Class1" with two attributes "id" and "name" and their respectives setters & getters.
There is a second class "Class2" extending "Class1" with an attribute "age" plus the getter and the setter.
In the web flow i return a jsp page as view with a list of elements of type "Class2" as model.
In the jsp page i do the following:
<c:forEach items="${model.class2}" var="item">
<td>
<p>Name: <c: out value="${item.name}"/></p>
<p>Age: <c: out value="${item.age}"/></p>
</td>
</c:forEach>
Tomcat launchs an error for item.name:
Unable to find a value for "name" in object of class "Class2" using operator "." (null)
However, if a let only the second value it works:
<c:forEach items="${model.class2}" var="item">
<td>
<p>Age: <c: out value="${item.age}"/></p>
</td>
</c:forEach>
What can be the problem? Any suggestions?
I have a class named "Class1" with two attributes "id" and "name" and their respectives setters & getters.
There is a second class "Class2" extending "Class1" with an attribute "age" plus the getter and the setter.
In the web flow i return a jsp page as view with a list of elements of type "Class2" as model.
In the jsp page i do the following:
<c:forEach items="${model.class2}" var="item">
<td>
<p>Name: <c: out value="${item.name}"/></p>
<p>Age: <c: out value="${item.age}"/></p>
</td>
</c:forEach>
Tomcat launchs an error for item.name:
Unable to find a value for "name" in object of class "Class2" using operator "." (null)
However, if a let only the second value it works:
<c:forEach items="${model.class2}" var="item">
<td>
<p>Age: <c: out value="${item.age}"/></p>
</td>
</c:forEach>
What can be the problem? Any suggestions?