aspose file tools*
The moose likes JSP and the fly likes polling database from jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "polling database from jsp" Watch "polling database from jsp" New topic
Author

polling database from jsp

Varma dandu
Greenhorn

Joined: Apr 29, 2005
Posts: 16
Hi dudes,

I am working on an application which list out entries from a database(MSSQL).

These entries get updated by another application every second and i need to display the very latest info on my jsp page.

This means that i need to update part of jsp page(I dont want to refresh the whole page as it increases the network traffic) atleast for every 2 seconds by accessing the database.

can someone throw light on this.

Regards
Varma Dandu
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30294
    
150

Varma,
If you are using a modern browser, you can use iframes. This is the technique gmail uses to update a small part of the page.

I'm moving this to JSPs as it is more about page rendering than the database.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

You might also want to research XMLHttpRequest to perform "behind the scenes" requests to the server.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Implement Thread in Applet and include Applet in your JSP page.

Set sleep time 2 seconds.

In run() of Applet, fetch the information and display it.


My blood is tested +ve for Java.
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Implement Thread in Applet and include Applet in your JSP page.

Set sleep time 2 seconds.

In run() of Applet, fetch the information and display it.
Varma dandu
Greenhorn

Joined: Apr 29, 2005
Posts: 16
Thanz dudes for all ur replies.

I am actually bewildered with the options.

IFRAMES , XMLHTTPREQUEST , XML-RPC.

can anyone let me know which is best option where i need to get info and display it from a very dynamic database.

Thanx
Varma Dandu.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Varma dandu:
I am actually bewildered with the options.

IFRAMES , XMLHTTPREQUEST , XML-RPC.


As Bear said, XMLHttpRequest. Others are something else.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

These are all client side techniques.
XmlHttpRequest is a fairly new feature in javascript and may not be supported in older browsers.

Iframes have been around longer and will probably be supported in more browsers but they are more work.

I found this article to be useful:
http://developer.apple.com/internet/webcontent/xmlhttpreq.html


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

There are many options. And it can be bewildering, but when it comes down to it, only you can decide which is best for you. This is a good opportunity to learn a little about all the options presented so that you can make an informed choice.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: polling database from jsp