how to differ between new request and page refresh..
Joined: Apr 15, 2006
Hi, I have one chat application for which i am using one simple action class say LoginAction. Now i have index.jsp as the login page. Suppose i want to add the user into chat list when he comes from index.jsp with authentication. Using servletcontext i am managing the list in LoginAction class. Problem is everytime i refresh a page say with refresh button or pressing f5 same user gets added in to the list. How can i make a difference between new request and page refresh to avoid so. If you want i can provide the code also..
Thanks in advance Manoj Amrutkar
Joined: Feb 08, 2006
I am not sure about your "new request versus refresh" question...but the first thing that came to my mind would be to store the list using something like a HashMap, using whatever unique value you have (username?). Then before adding an entry to the list, call the containsKey method and only add new entries.
Joined: Feb 03, 2004
... you could use
- the session - a db-query
to find out that the user is already added to your chat :-)