Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to make date alarm in jsp

 
alsoumahi alBatal
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi experts, hope you are all fine , my question is how to create a jsp that works as alarm for me , I have a database contains dates , so I need my servlet
or the jsp itself always read the dates from the database and alarms me for nearest date as a popup message , or red headline , whatever is the way for alarming but the important thing
is how to do it

I think , the servlet must start with my tomcat server , once it is started , my date servlet automatically start and check for nearest date and alarm me for the shortest one ,
but I don't know how to make the servlet running with the tomcat once a tomcat is launched

thaaaaaaaaaaaaaaaaaanks guys for your help
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65542
110
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not the way web apps work. The servlet will execute only when a request is made from the browser.
 
alsoumahi alBatal
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:That's not the way web apps work. The servlet will execute only when a request is made from the browser.

thanks dear, maybe I am mistaken for the solution I gave but how can I do it , is there other solution guys !!!
please help
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65542
110
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think about it. If a timer goes off on the server, how can it possibly know how to contact one of the hundreds of millions of computers on the Internet? Without a request coming in from the browser (or other client), there's no connection.
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess it turns on what you mean by "alarm me". If your contact details are stored on the server, then the web app could send an email or text message if you make the proper arrangements for those.
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

Couldn't you use Ajax to poll your server at regular intervals - say 1 min - and display a popup or message if one of your dates is upcoming?

I'm making the assumption here that you are having your browser constantly sitting on the page waiting for something to occur.

Sean
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could do it by Ajax, as Sean told.

iFrame maybe will help you too.
 
Bhavesh Dak
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JSF/RichFaces there is a functionality of push/poll is provided where server can push data to client.
It is an Ajax based mechanism if you can try this may be serve your purpose.

Just Google Push and RichFaces you will find tutorial with example code.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65542
110
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bhavesh Dak wrote:In JSF/RichFaces ...

This is a JSP forum. Please do not bring up JSF solutions in this forum. If the poster is asking about JSF, this would be posted in the JSF forum.
 
Look ma! I'm selling my stuff!
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!