JSTL and beans inherited from ArrayList

P

pluck

I would like access properties as well as elements of a bean inherited
from ArrayList.
Can JSTL do that? Apparently, JSTL is interpreting the property name as
an index into the arraylist.

class JeffreyBean extends ArrayList {
public String getName() {
return "Jeffrey";
}
}

<jsp:useBean scope="session" id="bean" class="JeffreyBean"/>

<c:eek:ut value="${bean.name}"/>
 
C

Chris Riesbeck

pluck said:
I would like access properties as well as elements of a bean inherited
from ArrayList.
Can JSTL do that? Apparently, JSTL is interpreting the property name as
an index into the arraylist.

class JeffreyBean extends ArrayList {
public String getName() {
return "Jeffrey";
}
}

<jsp:useBean scope="session" id="bean" class="JeffreyBean"/>

<c:eek:ut value="${bean.name}"/>

As I read the rules for . and [] in Appendix A.3.4 of the JSTL
specification, it looks like you can't do this. As soon as JSTL sees
that bean is a List, it uses rules for indices, not properties.
 

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,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top