I never did figure out how to fix the exception I was getting, but I found
an alternate implementation that works. However, my business logic is built
on ArrayList and I didn't want to change that. Thanks to the magic of
getters and setters, I was able to do both:

-----
Form snippet:

private ArrayList items;
public Object getItems(int index) { return items.get(index); }
public Object[] getItems() { return items.toArray(); }
public void setItems(int index, Object item) { items.set(index, item); }
public void setItems(Object[] items) { }

public ArrayList getItemlist() { return items; }
public void setItemlist(ArrayList items) { this.items = items; }
-----

I noticed that setItems() is never called so I never bothered to implement
it. Everything is now working fine.

Thanks for your time.

Wiebe

-----Original Message-----
From: Michael Jouravlev [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 09, 2005 10:22 AM
To: Struts Users Mailing List
Subject: Re: Nested error

On 9/9/05, Wiebe de Jong <[EMAIL PROTECTED]> wrote:
> I just started using nested tags on a page, and when I submit it, Struts
> causes the following error:
> 
> HTTP ERROR: 503 Service Unavailable
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> RequestURI=/ecom/productSetUpdateSubmit.do
> 
> This happens before even getting to my action. The form is displayed
> correctly with several items in the collection.
> 
> JSP snippet:
> 
> <nested:iterate property="items"
> type="com.mycompany.ecom.dao.ProductSetItem">
> <tr>
>   <td class="label">Item:</td>
>   <td class="ecombody"><nested:text property="productPartID"
> styleClass="form"/></td>
>   <td class="ecombody"><nested:text property="status"
> styleClass="form"/></td>
> </tr>
> </nested:iterate>
> 
> Form snippet:
> 
> private Collection items;
> public Collection getItems() { return items; }
> public void setItems(Collection items) { this.items = items; }
> 
> 
> I'm running Struts 1.1 on JBoss-2.4.3_Jetty-3.1.3-1 with JDK 1.3.1_11
> 
> Any ideas? 

  <nested:iterate property="items"
  ...
  IndexOutOfBoundsException: Index: 0, Size: 0
  ...
  private Collection items; <--- null

> How do I get past this problem?

Initializing "items" might help.

Michael.

---------------------------------------------------------------------
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