This week's book giveaway is in the Java in General forum. We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line! See this thread for details.
I have a Book class which has properties such as id (long), name (String). Also, one of its properties is
Author has properties such as id, name, biography.
I have a book search form in which the total set of the Authors in my DB appears in a multi-select box. I was able have the authors that were selected by the user sent correctly to the controller (i.e. I could get them through the command as Set of Authors), but I want the next page (i.e. the result view page, which is the same page as the first search page) also to show the original search form filled with the values that were selected by the user. This was easy with regular text fields, e.g. the book's name: in the controller I got them loaded on the command object, and I simply kept them unchanged before sending the same command object to the view. But keeping the command's Set of Authors did not cause the view page to pre-select the relevant Authors in the multi-select box.... HOW DO I DO THIS TRICK???
that I need to "to override the equals method of the" Author class.... I did it (two Author classes are equal if they have the same id), but it did not help. Still, no Author is selected in the multi-select box in result page after I submit the search form.
We must know, we will know. -- David Hilbert
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop