I have an applet which communicates with a servlet which in turn connects to SQL. The applet is simply a calendar. By clicking on a day you choose that day as your appointment day, naturally if the day is not picked already. So my problem now is how to keep this calendar continuously updated? When a client picks a day, this day needs to be disabled on all other calendars. My first instinct is to include a separate thread that every x seconds performs a check to see what days have been picked. Im new to Servlets so my question is there a way that i can develop a servlet to notify all applets that a change needs to be made??? Thank you all for your time
I would not use a Servlet for this. Since you want the communication to originate at either end, a stand alone server would be best. There are a number of ways to do this. The quickest (just from what I have done) would be to write both the applet and server as RMI servers. Although they are both servers, they would act as clients to each other. The applet would connect to the server (which is on the same machine as the web server that servered the applet), which once it registers the client, connected to it as a client. Since each side now has a connection open RMI, they can call methods on each other at will. When the server gets an indication that one client has clicked on a day, it can notify all clients of this event.
Originally posted by john mattucci: Sorry but how would I create a stand alone server to sit on my web server
Think about what you need as a typical chat app. Whenever a client pick a day all the other clients connected in that moment should be noticed by your server. So as Ken Robinson said you should not use servlets to do it, but use, for instance, a thread running in your machine. This thread must open a port and listen through it...so acting as a stand alone server. And now follow the process mentioned above, using your server as a register of all the clients connected and sending them the proper message once a day is picked. -HTH
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop