Ignore servlet request initiated when user presses refresh or enter.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   David_Howie
Posted On:   Tuesday, November 27, 2001 02:07 PM

I have a page containing a form and a submit button. When the user submits the form, a servlet executes and processes the users request, then redisplays the updated page back to the user. At this point, the URL reflects the request that has just been processed. If the user then presses the browser's refresh button (or the enter key), the same request will be sent to the server and re-processed.


Does anyone know a good method/architecture that I can use to recognize that the request has already been processed so that I can simply ignore the request. I know I could change the URL after the initial request has been processed via the sendRedirect(), but I prefer not to use this method.

Re: Ignore servlet request initiated when user presses refresh or enter.

Posted By:   Bozidar_Dangubic  
Posted On:   Wednesday, November 28, 2001 06:20 AM

put the fact that request was processed in the session. that is the simplest thing you can do.

if(rq.getSession().getAttribute("processed")==null)
{
... do the processing
rq.getSession().setAttribute("processed","true");
}
About | Sitemap | Contact