1. Simple sort:
It works on default implementation (no backing bean code is required) To get it, make sortalbe attribute as true. You can make a specific column as default sorting on it. Have defaultSorted as
‘true’ for the column
Eg:

2. Custome Sort:
We can control the sorting behaviour programmatically. Sorting column can be capture in .jsp and logic implemented in backing bean
Eg:

sorting logic can be implemented in backing bean as below..(there are some additional methods too)

I hope this example helps you. I would appreciate your comments/feedback....
For more information: you can visit http://developers.sun.com/prodtech/javatools/jscreator/learning/bookshelf/
Thanks,
Adepu