Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not Getting the Latest data from databases in jsp page

 
sadhu charan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i am trying to fetch Latest Data from Databases in a continous manner for a particular time interval , i am getting but data not display in front page in a continous way it only display old data what shoud i do , I am using javascript ,core java with Oracle Database


Thanks
Scp
 
Krutik pandya
Greenhorn
Posts: 6
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

if you are not using ajax then I believe that you are using simple javscript code to generate the event to call requesting Page. Please check that how you are storing the result set data and getting data on jsp.

You can utilize collections classes to store result data pass it in the request on jsp page.

if you are doing same. post sample of code you are implementing.

Cheers,

Krutik
 
sadhu charan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Krutik
I am using javascript setTimeInterval method and calling java method got the value but its continuosly not display value only it display value while it is loading the page , if you have Ajax sample or code which continuosly checking Database and display data then help me


Thanks
Scp
 
Paul Clapham
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be useful if we had some idea of how you were calling a Java method from your Javascript code. Right now we have essentially no information about what you are doing, so making suggestions about what you should be doing is clearly impossible. So show us how you are doing that.
 
sadhu charan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i am just using setTimeInterval method inside setinterval methods i call a java function which get the data from data base Like:-

My code is like thats but it fetching only once not a one second interval , so if you have any ajax code or sample please send it

Thanks
Scp



 
Paul Clapham
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, I see. You are making a common mistake, namely you think that the HTML scriptlet is repeatedly evaluated in the browser. That isn't the case -- your JSP runs on the server and generates HTML (including Javascript) which is interpreted by the browser. If you use the "Display Source" feature in your browser you'll see that this is the case.

But for a better explanation, read The Secret Life of JavaServer Pages.

And yes, to do what you want to do you are going to have to use Ajax. However asking for random fragments of Ajax to be posted isn't going to be very useful, you're going to have to spend some time learning about it. Snippets aren't the way to go.
 
Krutik pandya
Greenhorn
Posts: 6
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, ajax is the way in your case. you ask the sample code. however, It will be better, you get basic idea and learn ajax first rather asking direct help.

W3school site is very nice to begin with ajax.

cheers,

Krutik
 
J. Kevin Robbins
Bartender
Posts: 1744
19
Chrome Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajax is a lot less painful if you use jQuery. I highly recommend jQuery in Action by our own beloved Bear.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic