• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to have a page CONTINUE to check Database Record?

 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
How to have a page CONTINUE to check Database Record? For example, there's a page which itself will periodically check the database, if there's any new data the page will Popup a new page with those data. My question is how can the page keep checking the database?
One of the solution(not good) is that there's a hidden frame with a hidden Servlet, it will refresh every x secs and connect database for every refresh, it seems not a good solution. Please suggest some idea. Thank you.
Ken
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are going to have to have either a hidden Applet (not Servlet) or a Javascript operation doing the checking. As you say, checking the database every few seconds is expensive - what about the process that may change the database - do you have any control over it? Could it signal the fact that a change has been made somehow?
Bill
 
Ken Shamrock
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>You are going to have to have either a hidden >Applet (not Servlet) or a Javascript operation
Hi,Applet is ok, but somepeople telling me that Applet can't control remote host(security reason),if u know, do u have any sample code for a applet to connect a db fequently? For Javascript operation, I think you mean this is a javascript keeping refresh the Servlet while the Servlet do the db connection and checking?
>the process that may change the database - do you >have any control over it?
Talking about the process, I may have a mobile agent which doing its job under the server or dispatched itself to other server and do query, finally after he finished querying, it will come back to our server to update the database.
Thanks
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The simplest way to do this is to use the META-REFRESH html tag. This will reload a page every x seconds. This is pretty hard on your servers, but easy on the development
<META HTTP-EQUIV="Refresh" CONTENT="30; URL=http://www.yoursite.com/some/place/">
The most modern way IMHO would be to use RTML. http://www.caplin.com/browser/rtml.html
 
Ken Shamrock
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi May, I don't want to have a hidden frame in my menu, so if Applet can do that, I can embed the hidden applet in the user menu, which keep checking the database and if db is updated, it will popup a new page (servlet page), but I don't know how to make it or if it's possible.
For RTML, have any sample code area? thanks for your suggestion
 
Chris May
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, there is no need for any frames. Just put the meta-refresh tag in the head section of the document you want to refresh with a reflexive (self-referencing) URL. The RTML stuff is cool, I've seen it in action, and have some whitepapers on it at work, but I haven't done any of it myself. I'm pretty sure it requires a proprietary server. Check the URL I linked above, and if it's all the same to you, I prefer to be informally called by my first name "Chris", not my last name "May" Good luck.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about a JMS solution?
 
Ken Shamrock
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chris, the reason for me to have hidden frame for refreshing is that once the user login, it will have a static menu on the left and the main screen on the right displaying information for the users, those refresh html tag can't be embedded inside those frames as those frames will be refreshed all the time.
Thomas, what is JMS solution?
Thx
 
Thomas Paul
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java Messaging Services. You set up a JMS server and post database updates to a topic on the server. Then applets/applications can subscribe to that topic and get automatically notified whenever anything is added to the topic.
 
Ken Shamrock
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds interesting! Could you provide me some tutorial about implementing applet with that server? And what ver jdk it uses? (As a matter of fact, my project need to use tomcat,JRUN,2 Aglet Server and MySQL together, all these combinations need use different ver of jdk.. at least 3 ver., the setting really make me headache.. :=o )
 
Chris May
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Chris, the reason for me to have hidden frame for refreshing is that once the user login, it will have a static menu on the left and the main screen on the right displaying information for the users, those refresh html tag can't be embedded inside those frames as those frames will be refreshed all the time.

Perhaps I don't understand Gaelic, but I still see no reason that you can't do a meta-refresh in the document to the right, but hey, it seems that you're hell bent on turning something very simple into something complex, so by all means, have at it. I'm sure it's just a matter of semantics, but if the frame on the right is going to be refreshed "all the time" why do you bother trying to refresh the data programmatically?
 
Ken Shamrock
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I should correct the sentence like this: those refresh html tag can't be embedded inside those frames, if so, those frames will be refreshed all the time.
Like the following image:

Left is menu and right is working place, so it's not reasonable to insert a reload tag at both frames. The only solution is to insert a hidden frame as pic shown, but it's quite 'dirty' if user find that there's frame keeping refreshing..
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Thomas Paul:
.....Then applets/applications can subscribe to that topic and get automatically notified whenever ......



in which version of java that a applet can be used as a JMS Client???
:roll:
 
Ken Shamrock
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,thomas,
can u give me some hint on how to use JMS or download it?(and use with applet,bacuase my deadline is coming soon,thanks very much
 
On top of spaghetti all covered in cheese, there was this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic