In this Tutorial we will develop a Html page which displays current date and time using jQuery and JSP.This Html page contains jQuery which calls JSP page to add date in the web page.
jQdate.html :
<head> |
jQdate.jsp
<%@ page contentType="text/html" import="java.util.*" %> |
Description of the program :
Following code line include jQuery JavaScript library in the html file :
<script type="text/javascript" src="jquery-1.4.2.js"></script>
During loading of the body "displayTime()" method loads automatically by using the following code line :
<body onload="displayTime()>;
$.ajax({
url : "jQdate.jsp",
Following code intercepts the ajax call success and then sets the data into "context" div:
success : function (data) {
$("#content").html(data);
}
Following code executes code/method after a specified time-interval :
setTimeout("timeExam()", 1000);
OUTPUT :

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.