I put the code beanB.size() >= myTable.getRowIndex() before remove the item and now the item in ArrayList is never being removed.


2006/6/1, James Richards < [EMAIL PROTECTED]>:
The example isn't very clear but based on the below

public void removeItem(ActionEvent event)
     {
         beanB.remove(myDataTable.getRowIndex());
         return null;
     }

Have you tried catching IndexOutOfBoundsException in the above method?  Also, why return null?  In any case, I would have an if ( beanB.size() >= myTable.getRowIndex()) or so to prevent any such problems.

Hope that helps,

James

-----Original Message-----
From: Rogerio Pereira [mailto: [EMAIL PROTECTED]]
Sent: Thu 6/1/2006 1:44 PM
To: MyFaces Discussion
Subject: Re: advice about dependency injection

Any sugestions?


I have 3 beans: beanA, beanB and beanC.
>
> Both beanA and beanB uses beanB (ArrayList), from beanA i only remove
> itens from beanB and from beanC i add, get and set a item in beanB.
>
> Everything is ok when beanC to these operations on beanB but if i try to
> remove an item from beanA i'm getting an IndexOutOfBoundsException.
>
> Note: i'm using saveState in beanA
>
> I'm following this wiki entry:
>
> http://wiki.apache.org/myfaces/AccessingOneManagedBeanFromAnother
>
> I have full details here:
>
> http://issues.apache.org/jira/browse/MYFACES-1312
>





--
Yours truly (Atenciosamente),

Rogério

Reply via email to