Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
Smitesh Shinde
Ranch Hand
Posts: 45
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try out AJAX approach.
AJAX
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay tell me , how can AJAX suit here .
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64633
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64633
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
" 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
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic