Results 1 to 8 of 8
- 11-22-2010, 07:30 AM #1
Member
- Join Date
- Aug 2010
- Posts
- 11
- Rep Power
- 0
how to add Arraylist filter for a jsp page showing results from a servlet-Arraylist
hello sir/mam, in my project i have an arraylist showing results in a jsp page table of given contents of database, i want to add a filter to it to show only the matched contents from list,
but i want the result to display page only for class_id::11 and remove other results how to do that?Java Code:the table which is coming out is as: student_id class_id student_name 1x0001 10 Ashish 1x2001 11 Anurag 1x2002 11 Arpit 1x0001 10 Alok .............going on...
and from that i want result filtered as this
Java Code:the table which is filter will show as: student_id class_id student_name 1x2001 11 Anurag 1x2002 11 Arpit .............going on...
- 11-22-2010, 10:31 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Change the query you're using to retrieve this stuff form the database?
- 11-22-2010, 10:48 AM #3
Member
- Join Date
- Aug 2010
- Posts
- 11
- Rep Power
- 0
easy to say hard to implement, the database query is in nests of joins and union thus its much harder to implement and also i am using getters and setters and the same query on many places where filter is not needed thus i asked for arraylist filtering ;)
- 11-22-2010, 10:55 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Nope.
You filter in the query.
You must be able to attach a filter to the existing query...joins and unions and all that are irrelevant if you still need to filter the result. Java will be so much slower than than the db at doing this.
- 11-22-2010, 11:05 AM #5
Member
- Join Date
- Aug 2010
- Posts
- 11
- Rep Power
- 0
yes i know but still i will emphasize on java, as changing my query will make my project upside down.
- 11-22-2010, 11:18 AM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Sounds like it's already upside down...anyway, iterate over the List calling the iterators remove method on the ones you don't want.
- 11-22-2010, 12:44 PM #7
Member
- Join Date
- Aug 2010
- Posts
- 11
- Rep Power
- 0
i am not using iterators in my code so should i need to re-write it with iterators
- 11-22-2010, 01:26 PM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Similar Threads
-
A private static ArrayList hold an object and static getter ArrayList
By Louis in forum New To JavaReplies: 2Last Post: 11-16-2010, 05:51 PM -
About printing Arraylist on JSP page....
By vaibhavspawar in forum Advanced JavaReplies: 0Last Post: 08-13-2010, 06:52 AM -
Unique Filter on search results
By selva in forum LuceneReplies: 0Last Post: 02-17-2009, 07:32 AM -
Need to filter the hash set which is dtoring my results
By appi_usa in forum Advanced JavaReplies: 0Last Post: 08-14-2008, 04:34 PM -
Java Project Trouble: Searching one ArrayList with another ArrayList
By BC2210 in forum New To JavaReplies: 2Last Post: 04-21-2008, 11:43 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks