wood burning stoves 2.0*
The moose likes Struts and the fly likes how to differ between new request and page refresh.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to differ between new request and page refresh.." Watch "how to differ between new request and page refresh.." New topic
Author

how to differ between new request and page refresh..

Manoj Amrutkar
Ranch Hand

Joined: Apr 15, 2006
Posts: 47
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
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
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.

- Brent
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
... you could use

- the session
- a db-query

to find out that the user is already added to your chat :-)

regards,
jan
 
Don't get me started about those stupid light bulbs.
 
subject: how to differ between new request and page refresh..
 
Similar Threads
JSP + struts html:select
AJAX Chat Problem
Can i avoid execution of action on page refresh(F5)..
JSP + struts html:select
Everytime i am refreshing(F5) a page the action gets called(How can i avoid?)