I've been thinking about a feature of the Apache Struts framework that I like which might suggest a better alternative to using return_url everywhere.
Whenever a page performs some kind of action, allowing the referring page some way to specify where to go after the action makes things much more flexible. Hence return_url.
Struts recognises that each action can have more than one outcome, and that you might want to go to different pages depending on the outcome. The 'action' page specifies a symbolic name for each outcome and the referring page assigns a url to each symbolic name.
For example, a page which creates a document might have the following outcomes represented by symbolic names of the form <type>.<detail>:
- cancel - the user cancelled the action
- failure.permission - the user doesn't have permission
- failure.locked - this folder is currently locked
- success.set_permission - the document was created and the user selected to set permissions on the document before finishing
- success.created - the document was created and the user is finished
The referring page can assign a default url for all outcomes, a default url for a type (cancel,failure,success) or a url for a specific outcome. The action page can also set local defaults.