aspose file tools*
The moose likes JSP and the fly likes When there is change in Databse Table data JSP also needs to be refreshed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "When there is change in Databse Table data JSP also needs to be refreshed " Watch "When there is change in Databse Table data JSP also needs to be refreshed " New topic
Author

When there is change in Databse Table data JSP also needs to be refreshed

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi ,

Hi ,

I have a requirement , in which .

I am showing a JSP page , on its onload Method i am getting the Data from Database and showing it .

The data might change continously inside Databse , Now my requirement is ,when ever there is a change inside Database data on to that particular table , i need to show that Latest data in my JSP page also .

Means , whenever there is a change in Database , i need to referesh the JSP Page to show these latest values .

(A site similar to Stock Exchnage)

what is the way to approach this ??


Waiting for your replies . Thanks .

Save India From Corruption - Anna Hazare.
Smitesh Shinde
Ranch Hand

Joined: Feb 16, 2008
Posts: 45

Try out AJAX approach.
AJAX
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Try out AJAX approach.


Okay you told AJAX , , tell me how AJAX suits here , how can i add a monitor on to my Database Tables with AJAX ??

I bet AJAX doesn't suit here .
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
You bet wrong. Obviously, it's not a tool for the DB but a tool for the web GUI, but it's where you should start looking.
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

Hey,

There may be database tools to monitor database changes, I can't say I have come across any but I'm still a newbie. Then you have the problem that if you did have a change you would need to tell anybody who has the webpage open that they need to refresh the data. While that's possible which javascript and ajax, it seems a lot more work.

Is there any reason you don't do what I imagine most stock exchange type sites do which is to reload the data at certain time intervals (every 5s, 60s or whatever) using ajax?

Sean


I love this place!
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

okay tell me , how can AJAX suit here .
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61658
    
  67

How do you think it can be used? People are trying to help you in this topic and you are seemingly putting no effort into helping yourself.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

How do you think it can be used? People are trying to help you in this topic and you are seemingly putting no effort into helping yourself.


Thats why i asked how AJAX can be used here ( as i am not new to AJAX , so i am sure that AJAX doesn't suit here )

See Boss , for example , if i tell use java Cloning , i must also say that how to use it with a scenario .
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61658
    
  67

Well, I'd venture to say that you are not thinking the problem through, or you are not as familiar with the concepts as you claim, because Ajax is the most appropriate solution for this issue.
Smitesh Shinde
Ranch Hand

Joined: Feb 16, 2008
Posts: 45

You do not need to monitor database at all. AJAX will allow you to make database request over a certain period of time allowing you to reload only the part of page which is dependent on changing daabase values without actually reloading the entire page.

Hope this helps.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

" whenever there is a change in Database , i need to referesh the JSP Page to show these latest values . "

but i dont want it to periodically refreshing .
Thank you all for your help , really i was being some modest with the replies from all of you .
actually i wanted the below thing
Is there any way , we can call a Servlet or a JSP from a Databse trigger .
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

Ravi Kiran Pattu wrote:Is there any way , we can call a Servlet or a JSP from a Databse trigger .


And what would you do with this servlet or JSP if you could call it?

Think about it, I'm sitting looking at your page, my browser has html, it knows absolutely nothing about JSP or servlets, there is no connection between your sever and my browser once the page has been loaded until another request is sent to the server.

This is standard, so how do we enable communication between my client and your server? JavaScript or more precisely AJAX. More info about it can be found here.

Sean
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

my browser has html, it knows absolutely nothing about JSP or servlets, there is no connection between your sever and my browser once the page has been loaded until another request is sent to the server.


I agree with you Sean , this was a good point .

I agree perodical refresh is the only solution . Thank you all of you .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: When there is change in Databse Table data JSP also needs to be refreshed