Hi EveryBody, I am working on a intranet Messaging System which involves sending messages to valid users whose name and password is maintained in a database table.Now the whole scenario is something like this when the sender sends a message to a valid user he gets a form in which he types his username,his own name and the message, this calls a servlet which updates a database table and checks whether the user to whom he sends the message has currently logged in or not(This is accomplished when the user logs in he calls a servlet which sets a flag in a databse table which contains valid username, password and a flag,this flag is set to on).Once he checks that the user has logged in he stores this information in a flat file which resides on the server.This file contains the username to whom the mesage is send, and a flag stating whether a particular message is read on not. Now I need to pop up a message to the sender everytime he recieves a new message.For this whenever the sender logs in his flag is set on on the databse table and then he has to "READ THIS FILE CONTINOUSLY , WHENEVER HE CHECKS ANY ENTRY OF HIS NAME IN THIS FILE,IT HAS TO PROMPT A MESSAGE SAYING U HAVE NEW MAIL"something what we get in a yahoo or any chat application. Please suggest me best possible ways to achieve this, my limitation is I can't use an applet(otherwise life wd have been easier for me) Thanking u all in advance.
Why must you use a servlet? Couldn't you use a normal Java application? Such an application could probably be built much easier (and more efficiently) using something like RMI, rather than servlets. Is there a reason that you must use servlets? Corey
yeah that is part of the architecture, I can't use RMI, otherwise life would have been easier
Joined: Dec 20, 2001
I don't know of a way to send a message to a random client from a servlet. Without a request from the client, I don't know how you'd contact them. The only thing I can think of would be to have each client (while logged in) poll the server for new messages at some interval. This probably isn't as real-time as you'd like, but it's about all I can think of. Also, if you're constantly refreshing the form, it might be awfully painful for someone to try to send a message if the form keeps "blinking" due to the refresh. Anyone have better ideas? Corey
Joined: Dec 09, 2000
well that is the problem, even if I set a time interval , all the clients have to poll the server at certain point of time, and it wd be awful if the whole page refreshes, but that can be taken care by using I frames and inter frame communication but is there another way to it
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Servlet running continously and refreshing data!!