aspose file tools*
The moose likes Servlets and the fly likes reminder pop up Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "reminder pop up" Watch "reminder pop up" New topic
Author

reminder pop up

arun andrew
Greenhorn

Joined: Dec 21, 2004
Posts: 7
Hi all,
I am a newbie programmer and i want to make a database of reminders which a user can enter through an html page and at the appointed time a pop up window will come reminding the user. i plan to use POSTGRESQL for database and jdbc to connect and plan to run the servlet on a tomcat.now my biggest problem is how can i keep track of the times in the database and act when the time is come....
regards
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

OK, first the database part. You can set up a timer that runs every five minutes that does a query on the database where the time is within the next five minutes, and what you get back you loop through and create your reminders.

Now getting the reminders to popup is another question that I don't think I can answer because of the request-response nature of Servlets and the web. I don't think that on the server-side you can start such a process. Plus how do you know the user has their browser up to get the pop-up.

You could write a simple client app that is a stay resident type program that can receive messages. You can still have the web app for entry.

But I could also be wrong.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

A hidden iframe with a meta-refresh tag would work well for this.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
In a rather sophisticated solution, we have an applet that registers with the server when it's started. It opens a ServerSocket and gives the server a userid, ip address and port. When the server decides to send a message to a user, it checks to see if the userid is registered. If so, it can talk right to that port and send data; the applet pops a window to show it to them. If the userid is not registered the server saves the message and the user queries for old messages next time they log on. This probably requires a distributed cache in a clustered system.

The other part of the story is how does the server know it's time to send something? We use a commercial timer package called Flux but I think one called Quartz is open source. Flux can persist timers to a database so they survive restarting or crashing the server, and Flux works in clusters so only one server tries to handle the timer event.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Sol Mayer-Orn
Ranch Hand

Joined: Nov 13, 2002
Posts: 311
Hi,
We have one system that's similar to the one suggested by Stan James above.
However, please note the above solution requires some care. In particular, "unsigned applets can only phone home", meaning you have to either put a digital signature on you applet, or make sure it's deployed on the exact same location as you servelt (admittedly i've never tried the latter).

For simple cases, i'd go with the "meta refresh" solution, although it offers much less sophistication & flexibility.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: reminder pop up