aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Display tag and sorting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Display tag and sorting" Watch "Display tag and sorting" New topic
Author

Display tag and sorting

shailesh kumar
Ranch Hand

Joined: Jul 18, 2005
Posts: 36
I am using Display tag library provided by Sourcefourge.net for pagination, It works great for me. The problem is it doesn't do the sorting independent of upper case and lower case. I want to do the sorting independent of upper case and lower case.
Does any one used this tag library before and solved this problem or somebody know how can I solve this issue ??
thanks to all.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18986
    
    8

I tracked down the documentation and read it.

If you want a fix now, then you should add another property to your beans that contains a version of your strings in all lower-case and use that property as the sortProperty attribute. Something as simple asshould work. Or you could volunteer to work on the project and add new attributes that allow providing a Comparator or a Collator to the sort. It is open-source so you could do that.
shailesh kumar
Ranch Hand

Joined: Jul 18, 2005
Posts: 36
Thanks for the reply but the solution which you gave me is to convert all the data to lower case, thats not what I want. I am sorry If was unable to explain properly. Here is the example.
This is my data:

A
a
B
b
C
c
D
d

My Business Object has this data and initially it displays as shown above which is independent of uppercase and lowercase. When I click on this column to do the sorting using display tag, it displays as

A
B
C
D
a
b
c
d

This is the problem it should do the sorting independent of case.
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
I haven't worked on Display tag library but if you follow the lines of Paul you must be able to do case insensitive sorting.

Assuming the tag library sorts on all java objects you can do the following:

- Create a Wrapper for the data you want to perform case insensitive sorting as shown below:



And use this wrapper class in the display object.
[ January 19, 2006: Message edited by: Purushothaman Thambu ]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18986
    
    8

Originally posted by shailesh kumar:
Thanks for the reply but the solution which you gave me is to convert all the data to lower case, thats not what I want. I am sorry If was unable to explain properly.
Obviously I didn't explain properly either.

I understood your explanation. The code I posted was not intended to convert all the data to lower case, and in fact it does not do that. It just provides a separate property in your bean that you can use for sorting. Only for sorting. Do not use this property for displaying. Display the "data" property but sort on the "caseInsensitiveData" property.
shailesh kumar
Ranch Hand

Joined: Jul 18, 2005
Posts: 36
Thanks, I got it..
Raj kumar
Greenhorn

Joined: Jan 06, 2005
Posts: 15
Hi Shailesh,

It would be helpful if you can tell us how you fixed this problem.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display tag and sorting