JSTL with Struts c:forEach

J

Jack

Hi,

I have a bean collection passed back to a jsp from a
RowSetDynaClass.

jsp has the following code to loop through ea
<c:forEach var="person" items="${findpersonresults}">
<tr>
<td><c:eek:ut value="${person.seq}"/></td>
<td><c:eek:ut value="${person.name}"/></td>
</tr>
</c:forEach>

I get the exception:

[ServletException in:/findperson.jsp] An error occurred while
evaluating custom action attribute "value" with value
"${person.seq}": Unable to find a value for "seq" in object
of class "org.apache.commons.beanutils.BasicDynaBean" using
operator "." (null)' javax.servlet.ServletException: An error
occurred while evaluating custom action attribute "value"
with value "${person.seq}": Unable to find a value for "seq"
in object of class
"org.apache.commons.beanutils.BasicDynaBean" using operator
"." (null) at
org.apache.jasper.runtime.PageContextImpl.handlePageException
(PageContextImpl.java:533) at

if I just do <c:eek:ut value="${person}"/> I get:
org.apache.commons.beanutils.BasicDynaBean
which is what I'd expect.


My previous, Struts taglib based, code works fine:

<nested:iterate id="person" name="findpersonresults">
<tr>
<td><nested:write name="person" property="seq"/></td>
<td><nested:write name="person" property="name"/>
</td>
</tr>
</nested:iterate>

Any ideas what's wrong?

Thanks!
 
V

VisionSet

Jack said:
Hi,

I have a bean collection passed back to a jsp from a
RowSetDynaClass.

jsp has the following code to loop through ea
<c:forEach var="person" items="${findpersonresults}">
<tr>
<td><c:eek:ut value="${person.seq}"/></td>
<td><c:eek:ut value="${person.name}"/></td>
</tr>
</c:forEach>

I get the exception:

[ServletException in:/findperson.jsp] An error occurred while
evaluating custom action attribute "value" with value
"${person.seq}": Unable to find a value for "seq" in object
of class "org.apache.commons.beanutils.BasicDynaBean" using
operator "." (null)' javax.servlet.ServletException: An error
occurred while evaluating custom action attribute "value"
with value "${person.seq}": Unable to find a value for "seq"
in object of class
"org.apache.commons.beanutils.BasicDynaBean" using operator
"." (null) at
org.apache.jasper.runtime.PageContextImpl.handlePageException
(PageContextImpl.java:533) at

if I just do <c:eek:ut value="${person}"/> I get:
org.apache.commons.beanutils.BasicDynaBean
which is what I'd expect.

Think it something to do with the fact that Dyna Beans have just get(String
x) & set(String x, String val) type methods and you are asking for a
getSeq() method.
 
V

VisionSet

ftp://ftp.java.sun.com/pub/spec/jstl/enov1818/jstl-1_0-fr-spec.pdf

jstl spec above

I don't think you can access data that lies behind a get(String key) method
with jstl
that is a struts thing.
jstl can access regular getMyData() methods in beans and most if not all
collections.
That's it.
Annoying, I want to access constant model tier data with it and can't.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top