Re: Refresh button and Back button
The back button problem is standard. You need to use a token to prevent sensitive form resubmission. This is documented in Geary's Advanced JSP book and Core J2EEE patterns. They are both put out by Sun. In short, tokens allow you to determine whether the page should be processed in the normal way. You include a token in the request and save a copy in the session. When the page is submitted, you check that they match. If so, you can do normal processing. If not, you need to decide what to do. Struts supports tokens, but the implementation is opaque (IMHO). Geary's book provides a good treatment. However, there is an error in the code he uses to check tokens (don't have book in front right now, so can't spell it out). I think he does not check all the cases he says he does. At any rate, the code is in the book for the test tokens tag he develops. Even if you used the Struts implementation, you would have to use his logic. Bud -- ___ Bud Gibson e-Lab Czar Assistant Professor University of Michigan Business School 701 Tappan Street, C2424 Ann Arbor, MI 48109-1234 ph: 734\647-9200 fax: 734\764-3240 [EMAIL PROTECTED]
Refresh button and Back button
I'm sure many of you have run into these problems before: 1. My form is stored in the session, when the user updates, it goes back to a list screen, the SaveAction servlet removes the form from the session. PROBLEM: A NullPointerException is thrown when the user clicks on the back button. 2. When a user saves a form, they return to the list screen, PROBLEM: Another record gets added to the database. Is there anyway in struts to manipulate the header so the back and refresh think the last page was the current page? Can I do this in the SaveAction servlet? Please offer any workarounds that you have implemented in your struts applications. Thanks, Matt __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Re: Refresh button and Back button
Basically, the problem is with browsers' caching. For example, IE will ignore header settings you sent. In several references you will find methods to set headers, but they all ignore to recognize that it is after all the browser that decides and/or ignores. Back buttons are developers' nightmare. --- Matt Raible [EMAIL PROTECTED] wrote: I'm sure many of you have run into these problems before: 1. My form is stored in the session, when the user updates, it goes back to a list screen, the SaveAction servlet removes the form from the session. PROBLEM: A NullPointerException is thrown when the user clicks on the back button. 2. When a user saves a form, they return to the list screen, PROBLEM: Another record gets added to the database. Is there anyway in struts to manipulate the header so the back and refresh think the last page was the current page? Can I do this in the SaveAction servlet? Please offer any workarounds that you have implemented in your struts applications. Thanks, Matt __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/