Created
March 14, 2009 21:30
-
-
Save deepj/79190 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping("/book/listByTitle") | |
public ModelAndView listByTitle() { | |
List<Book> sorted = bookDAO.getAll(); | |
java.util.Collections.sort(sorted, new Comparator(){ | |
public int compare(Object o1, Object o2) { | |
Book b1 = (Book) o1; | |
Book b2 = (Book) o2; | |
return b1.getTitle().compareTo(b2.getTitle()); | |
} | |
}); | |
return new ModelAndView("views/book/list", "books", sorted); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment