Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reminder pop up

 
arun andrew
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A hidden iframe with a meta-refresh tag would work well for this.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sol Mayer-Orn
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic