Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Back button and JSP

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Do u have any idea how to deal with Back Button in IE 5.5 and up. to direct it to a specific url other that the actual previous url ?
Thanx
Ala'a
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cant reliably do this -- the browser may simply get the page from Cache, and so you have no control.
Probably your best bet, is to pass a transaction id (page view id or something) on the URL or as a hidden field, then check the client and server numbers when the client hits a link.
If the numbers are not the same then you can do your custom "you pressed the back button" page.

James
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alaa
JavaRanch has a Naming Policy Following it is a requirement for entry to the Book Giveaway. Please change your Display Name to comply.
[ August 27, 2002: Message edited by: Carl Trusiak ]
 
Alaa Abutabaq
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks friends for your advices .
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it is not exactly how to redirect user to a specific url, it is about back button in general.
One way to solve back button problem is to keep all data that your page need on a page itself.
Note , this is just something that I tryed and it worked, and had acceptable perfomance with about 77K of session info with page accessed through LAN .
It will slow down page loading, but it not that bad, and anyway you not suppose to put a lot of data in a session. Also you could have some data on a session, but all your page specific info on a page - just find the right balance. .

So , instead of puttting data in session, I put it into my object. This object has HashMap inside, and for my convenience implements HttpSession interface (so it was easier to move my code to use this object). I transform this hashMap to String and put on web page as a hidden textarea field. I sent to a server with each form submission, and instintiate an object.
When I transform it to string, I use ObjectOutputStream, ZipOutputStream and ByteArrayOutputStream, to minimize amount of information.
this is object, that I used.
Note, that bytesToString() and stringToBytes() was the fast solution guaranteed to work , not the best one.
So saveIt method puts data into request, and constructor reads it from request.

and this is an example of useing it

[ August 28, 2002: Message edited by: Yuriy Fuksenko ]
 
Something must be done about this. Let's start by reading this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic