• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to differ between new request and page refresh..

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
... you could use

- the session
- a db-query

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

regards,
jan
 
reply
    Bookmark Topic Watch Topic
  • New Topic