You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Odelya YomTov <od...@jpost.com> on 2009/07/24 12:50:37 UTC

problem with removing item from a paginated list

Hi!
After deleting an item, I thought to delete it from my paginated list like
this:
yalkutService.deleteProduct(workingItemId);
ProductData tmpData;
for (int i = 0; i < productsList.size(); i++) {
	tmpData = (ProductData) productsList.get(i);
	if (String.valueOf(tmpData.getMakat()).equals(workingItemId)) {
		productsList.remove(i);
		break;
	}
}
}

But I get a JSP exception: 
ERROR [http-8080-Processor24] - Servlet.service() for servlet action threw
exception
javax.servlet.jsp.JspException: Exception accessing property lastPage for
bean products: java.util.ConcurrentModificationException
	at
org.apache.struts.taglib.logic.CompareTagBase.condition(CompareTagBase.java:
189)
	at
org.apache.struts.taglib.logic.NotEqualTag.condition(NotEqualTag.java:46)
	at
org.apache.struts.taglib.logic.ConditionalTagBase.doStartTag(ConditionalTagB
ase.j

how can I solve it?

Thanks!


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: problem with removing item from a paginated list

Posted by Jon Moores <jo...@gmail.com>.
Hi,

I dont think you should be removing from the list while iterating at the
same time.

Create a separate list (deleteProductList) and replace the
productList.remove() call with deleteProductList.add(tmpData).

After you finish iterating productList iterate over deleteProductList
calling the productList.remove() for each entry in there.

Thanks
Jon

Re: problem with removing item from a paginated list

Posted by Brandon Goodin <br...@gmail.com>.
Don't use the PaginatedList. It's deprecated. You should just use the
queryForList with the max and skip parameters. You get back a basic list.
Then you can do what you want with it. If your jsp problem still exists at
that point then it is something other than iBATIS.
Brandon


On Fri, Jul 24, 2009 at 8:03 AM, Odelya YomTov <od...@jpost.com> wrote:

>  Hi!
>
> I tried your advice, but with no solution to my problem..
>
> I problem is when writing the paginated list to the jsp, not in the JAVA
> code.
>
>
>
> Thanks!
>
>
>
> *From:* Jon Moores [mailto:jonathan.moores@gmail.com]
> *Sent:* Friday, July 24, 2009 1:59 PM
> *To:* user-java@ibatis.apache.org
> *Subject:* Re: problem with removing item from a paginated list
>
>
>
> Also on the assumptions thats
>
> = your ProductData class implements the equality and hashcode methods
>
> =  those methods use your 'id' field
>
> = You have a ProductData constructor that takes the id field
>
>
>
> you should simply be able to do:
>
>
>
> productList.remove(new ProductData(workingItemId));
>
>
>
> no need to iterate.
>
> Thanks
>
> Jon
>
>
>
>
>
> ************************************************************************************
> This footnote confirms that this email message has been scanned by
> PineApp Mail-SeCure for the presence of malicious code, vandals & computer
> viruses.
>
> ************************************************************************************
>

RE: problem with removing item from a paginated list

Posted by Odelya YomTov <od...@jpost.com>.
Hi!

I tried your advice, but with no solution to my problem..

I problem is when writing the paginated list to the jsp, not in the JAVA code.

 

Thanks!

 

From: Jon Moores [mailto:jonathan.moores@gmail.com] 
Sent: Friday, July 24, 2009 1:59 PM
To: user-java@ibatis.apache.org
Subject: Re: problem with removing item from a paginated list

 

Also on the assumptions thats

= your ProductData class implements the equality and hashcode methods 

=  those methods use your 'id' field 

= You have a ProductData constructor that takes the id field

 

you should simply be able to do:

 

productList.remove(new ProductData(workingItemId));

 

no need to iterate.

Thanks

Jon




************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************


Re: problem with removing item from a paginated list

Posted by Jon Moores <jo...@gmail.com>.
Also on the assumptions thats
= your ProductData class implements the equality and hashcode methods
=  those methods use your 'id' field
= You have a ProductData constructor that takes the id field

you should simply be able to do:

productList.remove(new ProductData(workingItemId));

no need to iterate.
Thanks
Jon