Home Answers Viewqa Ajax refreshing a jsp without flickering effect for every 5 seconds using ajax

 
 


suresh anugandula
refreshing a jsp without flickering effect for every 5 seconds using ajax
1 Answer(s)      a year and 10 months ago
Posted in : Ajax

I want to refresh a jsp without flickering for every 5 seconds using ajax.This jsp is responsible to get the new records from the database and display the records in the form of a table. I don't know how to use ajax. Please send me one example for the same. Please help me. Please send your answer to.

View Answers

July 18, 2011 at 4:28 PM


1)ajax.jsp:

<%@page import="java.sql.*"%>
<META HTTP-EQUIV="Refresh" CONTENT="5">
<html>
<head>
<script type="text/javascript">
function showData(){ 
xmlHttp=GetXmlHttpObject()
    var url="getdata.jsp";
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged(){ 
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
     document.getElementById("tab").innerHTML=xmlHttp.responseText;   
    } 
}
function GetXmlHttpObject(){
var xmlHttp=null;
try{
  xmlHttp=new XMLHttpRequest();
 }
catch(e){
 try{
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch(e){
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
</script>
</head>
<body onload="showData();">
<table id="tab">
</table>
</body>
</html>

2)getdata.jsp:

<%@ page import="java.sql.*" %> 
<%
 String buffer="<table id='tab' border='1' >";  
 try{
  Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
 Statement stmt = con.createStatement();  
 ResultSet rs = stmt.executeQuery("Select * from employee");  
   while(rs.next()){
   buffer=buffer+"<tr><td>"+rs.getString("name")+"</td><td>"+rs.getString("address")+"</td><td>"+rs.getString("contactNo")+"</td><td>"+rs.getString("email")+"</td></tr>";  
   }  
 buffer=buffer+"</table>";  
 response.getWriter().println(buffer);
 System.out.println(buffer);
 }
 catch(Exception e){
System.out.println(e);
 }
 %>









Related Pages:
refreshing a jsp without flickering effect for every 5 seconds using ajax
refreshing a jsp without flickering effect for every 5 seconds using ajax  I want to refresh a jsp without flickering for every 5 seconds using ajax.This jsp is responsible to get the new records from the database and display
ajax
ajax  I am facing following problem, I am using ajax to get the data continousely without refreshing. Here i have devided a web page into 3 parts(top,left and right) using table in jsp. On the left part i am displaying some
Ajax Training Course
; Ajax to make a call to the server without refreshing a page. Modifying contents  on a web page without refreshing the whole page... Ajax Training Course      
Refreshing JSP - JSP-Servlet
Refreshing JSP  Sir, I am retriving corresponding values to dropdown listbox2 dynamically from database when i select a single value within the same application in drop down list box 1 using javascript.location().My problem
ajax code with jsp - Ajax
ajax code with jsp  hi , Sorry for insufficient data.i m making some correction on question. I have to perform some calculation on my jsp page. i want to do it automatically (using ajax in jsp). problem is - i hv two
Ajax Learner - Ajax
application. You can do all these things without refreshing your page. Benefits of Ajax... these days. Here are the benefits of using Ajax: * Ajax can be used...Ajax Learner  Hi, This is Ziaul,I am working as Java/j2ee Developer
Ajax Learner - Ajax
application. You can do all these things without refreshing your page. Benefits... these days. Here are the benefits of using Ajax: * Ajax can be used... the page data continuously without refreshing the whole page For read more
Simple Ajax Example, Developing Simple Ajax application
application that sends the user name on the server without refreshing the page...Simple Ajax Example       Simple Ajax Example In this tutorial we are going to develop a very simple Ajax
Ajax user interface - Ajax
these all has to be do using JSP,AJAX,JDBC what exactly i needed... is to design the database interaction using AJAX my requirement is a table... the operation has to be performed without page refreshing this requirement
Round of to a multiple of 5 without using function
Round of to a multiple of 5 without using function  Please help me out... U enter values like 239, 2543.876, 962.... Give me an equation without using any function which will give output of 240, 2545, 960 respectively
Round of to a multiple of 5 without using function
Round of to a multiple of 5 without using function  Please help me out... U enter values like 239, 2543.876, 962.... Give me an equation without using any function which will give output of 240, 2545, 960 respectively
Div (Ajax Tag) tag Example
without refreshing the entire page. The div tag when used with Ajax refreshes the content of a particular section without refreshing the entire page. HTML...; Create a jsp using the tag <s:div>.    
AJAX - Ajax
continuously without refreshing the whole page For more information on Ajax... refreshing your page. Uses of Ajax : * Ajax can be used for creating...AJAX  what is Ajax?WHAT IS THE USAGE OF IT?WHERE WE HAVE TO USE
The 'innerfade' effect using jQuery plug-in
The 'innerfade' effect using jQuery plug-in In this tutorial , we... 'innerfade ' function. This effect is implemented using "... color="red"><h2> The InnerFade Effect using "jqfade.js
Ajac code with jsp - Ajax
to perform some calculation on my jsp page. i want to do it automatically that is possible using ajax. problem is - i hv two text box. 1st take... box automatically without refreshing page. If any body know this plz help me
page is not getting loaded when refreshing???
page is not getting loaded when refreshing???  I am loading an image section(image,demo link,Zoom) in a webpage by using javascript function in JSP. It will get all details of image section from database. I am getting header
displaying List of records from database in a jsp using ajax
displaying List of records from database in a jsp using ajax  Sir, I need to retrieve the records from the database for every 7 seconds and display...;%@page import="com.tbss.RtChannels"%><%@ taglib uri="http://java.sun.com/jsp
using jsp's....and ajax - Ajax
using jsp's....and ajax  Hi, i need code using ajax .....in a text box when i enter an alphabet i should get list of words starts with the alphabet given in the text box
Ajax Training Course
; on a web page without refreshing the whole page Server-Side form validation with Ajax Manipulate XML documents with JavaScript using the DOM... Language, such as JSP, PHP, ASP.NET. Ajax Training Course Outline
JSF Search Application Using Ajax
JSF Search Application Using Ajax     ... using Ajax. This is a simple application in which, you will see two JSF.... This application here using JSF and AJAX technology that mean this is based on the JSF
Ajax Code Libraries and Tools
is designed as a base application and guide for building AJAX applications using... of JavaScript, without the need for refreshing the entire page. The Spry framework... refreshing the browser. AjaxCFC is a ColdFusion framework meant to speed up ajax
ajax in java - Ajax
will come "Caseno exist" Sir I am using Ajax first-time.Please help me.  .... You can do all these things without refreshing your page. For more...ajax in java  Dear deepak sir, My page contain several control
Ajax
Ajax  how to impliment ajax in registration table using jsp-servlet
JSP and AJAX- very urgent - Ajax
JSP and AJAX- very urgent  Respected Sir/Madam, I am... from the letter entered in the text box, is present, without reloading the page (Using AJAX. for ur reference, I have included the coding below: Login.html
ajax
ajax  how to connect ajax with mysql without using php,asp or any other scripting language. please answer soon
without using built-in functions
without using built-in functions  Hai sir... Please help me to solve this... Findout occurances of each string in every another string (built - in functions are not at all allowed) all, and, sand, falling wall and sand
Ajax
Ajax  how to include ajax in jsp page?   Hi, Please read Ajax First Example - Print Date and Time example. Instead of using PHP you can write your code in JSP. Thanks
Login Form using Ajax
Login Form using Ajax      ... using the Ajax (DOJO).  Lets develop a login application using Ajax...;/action> Develop a Login Form Using Ajax : The GUI of the application
Draw graph using jsp without database connection
Draw graph using jsp without database connection  Draw graph using jsp code without database connection
ajax
me reg this. thanks KK   Combobox box using Ajax in JSP   i...ajax  HI, In my application using ajax if i type a managername in the textbox it should display all the employees under the that manager
using tiles without struts
using tiles without struts  Hi I am trying to make an application using tiles 2.0. Description of my web.xml is as follows: tiles... tiles-servlet tiles-api tiles-core tiles-jsp When i try to run my web
Ajax Examples
to understand Ajax with JSP. The objective of the example is to display the current date of the server on the page on each key up event by the user without...Ajax Examples        
ajax example
in jsp page?   Hi, Please read Ajax First Example - Print Date and Time example. Instead of using PHP you can write your code in JSP... form in Ajax using jQuery framework. Thanks  DOJO
jsp and ajax
jsp and ajax  how to enable or disable textbox using radio buttons by using jsp and ajax
jsp & ajax
jsp & ajax  how to enable or disable textbox using radio buttons by using jsp and ajax? plz help me.... i m new in jsp & ajax
Developing responsive Ajax based Applications with ajax technologies
server without refreshing the whole page. JavaScript is used to send the request... can use Ajax with any server side technologies such as PHP, JSP, Servlets... application using ajax. Ajax Resources Ajax Code Libraries and Tools
ajax jsp - Ajax
ajax jsp  multiple combo with ajax using jsp?  Hi friend, I am sending you a link. This link will help you. Please visit for more information. http://www.roseindia.net/jsp/comboSelect.shtml Thanks
Popup Window using Ajax In JSP
Popup Window using Ajax In JSP  ... Window application using Ajax in JSP. For this, we will create the following...;</H3></BR> <table cellspacing=5 cellpadding=5
Ajax using jsp
Ajax using jsp  <%@ page import="java.io.*" %> <%@ page import="java.util.*" %> <%@ page import="java.sql.*" %> <%@ page import...); } %> Is there Any error...........In first Page I use ajax for displaying
How retreive data from database without using post method in jsp - JSP-Servlet
How retreive data from database without using post method in jsp  ... Ajax.We have provided you a link.In that example, with the use of Ajax, we take..., not on another page so use both the jsp pages. http://www.roseindia.net/jsp
ajax using jsp
ajax using jsp  <%@ page import="java.io.*" %> <%@ page import="java.util.*" %> <%@ page import="java.sql.*" %> <%@ page import="java.util.StringTokenizer" %> <%@ page import="java.lang.*" %> <
How to save form fields into the MySql Database without submit button in jsp?
How to save form fields into the MySql Database without submit button in jsp?  I want to store user inputs into the database using javasccript or ajax or jqury but without submit button. Form Contains three fields
Ajax Tutorials
advantages and disadvantages of using AJAX but for now all you need to know is any... with your Web browser.     Guide to Using AJAX... servers without refreshing themselves. The benefit to end users
jsp - Ajax
jsp  I'm very new in using the jsp and ajax, i have some JSP pages and i need to add some ajax features in my jsp page, for the example i need.... How can I implement this and then add this to my jsp page? please
datagid with paging using jsp - Ajax
datagid with paging using jsp  datagrid with paging using ajax and jsp  Hi friend, For read more information : http://www.roseindia.net/jsp/data-grid.shtml Thanks
ajax and jsp code - Ajax
ajax and jsp code  can u please give me the code for retriving the data from database using ajax our requriment is if i select country name in listbox display the corresponding all the states. using jsp and ajax   
Create an array of 5 doubles...
Create an array of 5 doubles...  Part one In a Java program, create an array of 5 doubles. Have the user input values into these array items inside a loop using JOptionPane. Using the loop, calculate the sum and average of the 5
JSP and AJAX very urgent - Ajax
JSP and AJAX very urgent  Hi Team, This is Ragavendran.R.. I have a very basic doubt in AJAX. While Using AJAX, of course, there will be tag involved in JSP page. But in my current project, I am using too many tags
ajax basics - Ajax
without refreshing your page. Advantages : * Ajax can be used... the page data continuously without refreshing the whole page For more Examples...ajax basics  i need ajax basics where can i find
Java add seconds to Date
Java add seconds to Date In this tutorial, you will learn how to add seconds... used in date time manipulation. Here, we are going to add few seconds... instance and get a date to represent the current date. Then using the method

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.