backpath

backpath is a Java library to implement "back" button on web pages without JavaScript.

Description

A common used feature in web-based project is "back" button. There are two used ways to implement it:

  1. document.history.back() method in JavaScript. Main disadvantage - it doesn't work if user has JavaScript disabled. And it just double of standard browser function. It doesn't work as expected if web application has complex structure, e.g. multi-page lists or submit forms.
  2. Each web page knows a preceding one and forms link URL just to it. But if some page is used more times in the application (e.g. "order details") then it has to distinguish different origins.

The backpath library solves this problem in general way. It saves all user movements between pages hierarchy and allows the application to control this information. No server side session is used, all information is stored as part of URL.

Limitations

In any case the library works fine in several real-world projects.

Usage

The most comfortable usage of the library is in applications based on Struts+JSP. For the case the library provides a taglib with a few tags. All Struts html:link in JSP should be replaced with one from the library, which has the same parameters and provides the same functionality but additionally adds necessary request parameters. To insert the back link to page just use backpath:back tag. All other things are done automatically.

If you don't use Struts or JSP in your project you can (and have to) use lower level: initialise the backpath on HTTP request and then add a special parameter to all links that have to have the "back" possibility.

Licence

Public domain - you are allowed to use it in any way.

Download

The project is available as source code via Subversion repository or for on-line view. Subversion URL is https://www.26th.net/svn/general/backpath/trunk/

Support

The library is provided AS IS without any warranty. I do not promise anything about it.

But nevertheless if you found a bug or require some feature - please submit it to bugzilla.

If you have some questions or problems with the library - ask me per email.

Once again - no warranty.

© Anatoli Klassen