JSP Instant Messenging

Can anybody suggest a way to implement a service where a user post a text message and it appears instantly(not instanly but real time) on the admin( or simply just another user)'s screen automatically. like a chat sesson just that the receiving end user will not be replying. If possible try to be as detail as possible in offering ideas or solutions for I am new to jsp.. (nv done anything in it b4) thanks:> ^_- cheers. Do offer links to tutorials or source code of related topics.
PS: Both receiving n sending users are connectin thru a web broswer. Sort of like a moderator at home receiving comments real time..
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If you store a list of all the current sessions (using a session listener to add them into a Hashtable when they are created, and remove them when they are destroyed)

Then you could store an ArrayList of messages inside the session object, and the user could be shown the last n messages that they recieved...

Of course, this is a transient solution, as if the user has simply closed their browser, then they will never recieve the messages

So you will need to store the messages in some permanent format (file or db), and then when the user logs on, or visits a page, check for new messages in the db and return them to the user...

jyhirokoAuthor Commented:
Method seems clear but i got no idea how to implement this.. let me try to digest it for a while. Any source to refer to?
jyhirokoAuthor Commented:
Will the message auto pop up on the receiving end automatically  upon submition by the sender?
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

>  Will the message auto pop up on the receiving end automatically  upon submition by the sender?

No, you will either need:

a)  A frame which is constantly refreshing, and shows a popup if a new message has been recieved


b)  Only check when the page is loaded, and show a popup then...
jyhirokoAuthor Commented:
The problem is i got a solution for this.. but i need it to be real time. instead of contanst refreshing. Any alternative solutions?
JSP and web browsing in general is a "Client Pull" technology...  The server cannot just arbitrarially "push" data to the browser...

Alternative solutions:

Java Applet that checks for new messages every n seconds
   PRO:  less data fetched each time
  CON:  extra level of complexity -- OSX doesn't have LiveConnect for example

I'd do the small (hidden?) frame that checks every 30 seconds or so...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If you really need real real-time :) I am afraid you need to write an applet.... - Which does not have a lot to do with jsp.
jyhirokoAuthor Commented:
how to do it using applet?
jyhirokoAuthor Commented:
how to do it using applet?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.