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 .
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?
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.
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.
" 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 .
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.
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 .
subject: When there is change in Databse Table data JSP also needs to be refreshed