learn java
The moose likes JSP and the fly likes Checking for new messages in database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Checking for new messages in database" Watch "Checking for new messages in database" New topic

Checking for new messages in database

James Haville

Joined: Jul 19, 2010
Posts: 10

Not sure which section this should be in...

I've been working on a web-based project management system and was wondering how you may do the following:

1) When a user has a new message/comment on activity relating to them I want it to appear on their notifications
2) I want to display the number of notifications they have

So I will have to check the database for messages or comments. But how can I work out if these have not been accessed by the user and therefore whether to include them in the new notifications? Would I have a boolean value checking this somewhere(in a servlet?) which is returned from a database method (check number of times accessed...if zero then show in notifications). Maybe I would have a column in the database which has a value true or false as to whether its been accessed or not which is changed to true if it has been.

Does anyone have any suggestions?


Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 62312

You never store anything in the servlet,which must be written to be multithreaded.

If it's something that only applies to the current user's session, store info in the session. If the info must persist across sessions, it must be stored in the DB or other persistent storage.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link: http://aspose.com/file-tools
subject: Checking for new messages in database