Jun 29th, 2007, 10:30 AM
Newbie Q: How implement filter then submit?
I'm very new to Spring so pardon if this question is to vague or basic...
I'm designing a webpage where the user will be able to view a potentially long list of items. Call this the "summary" view. To help him find the item he's looking for I'll provide a set of inputs, like an date range, for example. After setting the date range, he can hit a "Filter" button, and the view list will be limited to the items within the range. When he's found the item he's looking for, he can select it via a radio button and press a "View" button the view the details of the selected item. Call this the "detailed" view.
So, I think I should use a SimpleFormController with the formView="summary" and successView="detailed". But my question is this: what is the best way to use Spring to get the view to refresh with the filtered list of items?
Any help is greatly appreciated! Thanks
Jul 1st, 2007, 03:18 PM
I'd rather implement your use case as two different controllers.
The first one should manage the filtering process. When the user wants to proceed to the detailed view, he or she is redirected to the detailed view controller. You can pass the information required by the second controller using POST or GET.
Notice that this way you can reuse the second controller.
Jul 2nd, 2007, 02:32 PM
I use POST for "actions" -- filtering in this case isn't really an action so I would do that with a GET. You'll then see items in the URL like "startDate=XXXX&endDate=YYYY" The user might want to bookmark this page so he/she can get back to it easily.
Originally Posted by ChuckAtEmbarq
Likewise they might want to get to the detailed view (and you aren't doing an 'action' on it like ordering more parts) so I would use a GET for that page as well, ie "partNum=1234" in the URL.
So I would make 2 separate controllers that extend AbstractCommandController.