Re: URLMapping pattern vs query parameters
Great thread. Let me clarify my use-case for you, since that’s come up a few times
In this case I’m selecting an Account to “manage” from a paged DataTable component showing a few dozen accounts, and then clicking the “Edit” button under the table. There will be additional buttons, too (e.g. Delete). The app designers want these to be buttons rather than links, and I agree with them (that would look a bit weird, actually, selecting an item in the table and then clicking a hyperlink). If the session times out before the button is clicked then they can’t edit/delete the Account anyway, so that’s a non-issue. The fact that this results in a form submission is irrelevant, really, and could be beneficial – being able to hook into that method may be required on some pages (there are more than just Account entities being managed in this app, and we want to use a similar pattern for all the datatable pages). Sure, figuring out which item in the datatable has been selected could all be done client-side I suppose, but there’s no technical reason why it has to be.
I’ve implemented the first suggestion and it works quite well (inject the ManageAccount bean into the FindAccount bean, and in the action method “editSelection” I set the ManageAccount bean’s ID parameter, then return “pretty:manageAccount”). I was concerned originally that the beans’ scopes would prevent this from working, but apparently it’s fine.