I expect that our designer wants to present a table with for instance, name, dates and say urgency. He will want to sort the table on clicking on a table header. To me this should be a common problem so I expect that a pattern is available to solve it. However I have not seen one that does that. Does anybody know of a pattern to use or is it a matter of building a class that simply does the sorting? I am talking jsp and the MVC model 2 pattern here.
Hi You can use a mediator pattern here. Mediator uses a controller which can receive messages and send messages in both directions. So from jsp if you a call a mediator which will decide what to do and direct jsps what to do. So if the user clicks on the column to be sorted with you can send a message t the mediator which will sort the messages and redirect to a new jsp or rearrange the data and ask the orignially jsp which raised the message to refresh with the new data Hope it helps Tell me if it not clear Farouk
Joined: Jul 27, 2001
Thank you. But a many to many is not required here. However there should be a control, because is a user clicked on a header and he does that again he expects the sorting order to be reversed. In other words sorting requires managing the state of a form. In the session object I have the data container which provided the data for that page. So I can do with just one sorting class that operates on a generic container. The order is just the following order of class containers in a generic container. I can sort them on a given field name.