Holger-

Where do you populate your Vector list????
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Vector.html

Vielen Danke,
Martin-
----- Original Message ----- From: "Holger Klawitter" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Tuesday, October 04, 2005 5:01 AM
Subject: how to create a list style bean?


Hi there,

I'd like to create an application scope bean for easy table row coloring
(tomcat 5.5.9, struts 1.2.7, using struts EL).

<jsp:useBean id="rows" scope="application" class="RowBean"/>
...
<logic:iterate id="book" name="booklist" indexId="i">
  <tr class="${rows[i]}">
...

Where the RowBean is meant as a virtual list returning the proper css class
for each row index. But my subclassing does not work:

public class RowBean extends java.util.Vector<String> {
 public String get( int idx ) {
   return idx % 2 == 0 ? "even" : "odd";
 }
}

I get the following error:

javax.servlet.jsp.el.ELException: Unable to find a value for "0" in object of
class "RowBean" using operator "[]"
org.apache.commons.el.Logger.logError(Logger.java:481)
org.apache.commons.el.Logger.logError(Logger.java:498)
org.apache.commons.el.Logger.logError(Logger.java:611)
org.apache.commons.el.ArraySuffix.evaluate(ArraySuffix.java:340)
...

This would mean that my rowbean is not "instanceof List"?!

What am I doing wrong? Is there a different, more elegant way for this task?
(I cannot use JSF).

Regards,
 Holger Klawitter

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to