how to return to the screen that called a screen?

how to return to the screen that called a screen?

I have an edit page for locations (just a data table with some info) and a location can be edited from several different screens.  Is there a way in my "save" and "cancel" screen action on the location edit page such that when those actions complete, it will direct the browser back to the screen that called it?  It would seem like this would be something that you could do.
Figured it out!
Can you tell us our solution ? It could be relevant for someone else.
Whoops, sorry.

So I don't know if there is a really cool built in functionality to do this but I kind of hard coded it.  What I did on the page that is being visited I put in an input parameter of type text I called "returnURL" which is not mandatory.  Then on the pages that call that page I include the text of how to get back to that page.  Using local vars and text combined the end text is something like "/sums/DepartmentList.aspx?DepartmentID=1".  If you put that in and get a 404 error, check your syntax.

Then on the page that is being visited at the end of any save/cancel actions I put in an if.  If the returnURL="" then go back to the standard page.  If this was a edit page, it would just go back to the list page for that type.  However, if the returnURL has something in it, it goes to an external url with the destination being returnURL.  Works great.

If you have any further questions on the above, let me know.
Hi Jason,

I guess that there isn't any built in tool for that, however i would like to sugest a change to avoid big url's and passing page/eSpace names. 

Create a Static entity with the URL's needed and in the input parameter you only have to pass the id you want, this way you also avoid hardcode text in your code.

One issue I might see with that is if the page I want to go back to is a specific object page.  By that I mean if I have an object called "Department" and on the department edit page I have a link to edit a location (another object), if I go to the edit location page from that department, when I return I want to go to that specific department edit page (hence the departmentid=1 in the example I gave.  How would you get around that with the static method?
Ok, you can use other approach. Have a table that will work like a stack, you insert the full URL (parameters too) and pass the id returned, on the other page just need to get the URL by Id.
If this behavior is to apply cross-application you can make the insert in the preparation of each page and the get instead of using the id can be made by geting the last inserted.

Can this suit into your case cenario?