JSTL el list subclassing and property conflicts

U

Usenet Poster!!!

I'm extending an ArrayList and adding my own property.

However, when I use JSP 2.0 and JSTL it can't seem to be able to
access the property, it keeps trying to coerce the name into an
Integer.

Example:

public class Foo extends ArrayList {
private String x = null;

public Foo() {
super();
}

public String getX() {
return x;
}

public void setX(String x) {
this.x = x;
}
}

My JSP goes something like this:

.....
<jsp:useBean id="foo" class="Foo"/>
<c:set var="c" value="${foo.x}"/>
.....

It complains that it can't convert x into an integer the error message
from Tomcat 5 is below:

javax.servlet.ServletException: The "." operator was supplied with an
index value of type "java.lang.String" to be applied to a List or
array, but that value cannot be converted to an integer.

Root cause

javax.servlet.jsp.el.ELException: The "." operator was supplied with
an index value of type "java.lang.String" to be applied to a List or
array, but that value cannot be converted to an integer.

So is this a "feature" that I can work around?
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top