October 25, 2008 at 1:04 PM
Hi friend,
Code to solve the problem :
"mainpage.jsp"
<html>
<head>
<title>Ajax Example</title>
<script language="Javascript">
function postRequest(strURL) {
var xmlHttp;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
var xmlHttp = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttp.open('GET', strURL, true);
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
updatepage(xmlHttp.responseText);
}
}
xmlHttp.send(strURL);
}
function updatepage(str){
document.getElementById("result").innerHTML =
"<font color='red' size='5'>" + str + "</font>";;
}
function showCurrentTime(){
var rnd = Math.random();
var url="showTime";
postRequest(url);
}
</script>
</head>
<body>
<h1 align="center"><font color="#000080">Ajax Example</font></h1>
<p><font color="#000080"> This very simple Ajax Example retrieves the
current date and time from server and shows on the form. To view the current
date and time click on the following button.</font></p>
<form name="f1">
<p align="center"><font color="#000080"> <input value=" Show Time "
type="button" onclick='JavaScript:showCurrentTime()' name="showdate"></font></p>
<div id="result" align="center"></div>
</form>
<div id=result></div>
</body>
</html>
"MyServletAjax.java"
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
public class MyServletAjax extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException{
response.setContentType("text/html");
Date date = new Date();
PrintWriter pw = response.getWriter();
pw.println(date);
}
}
"web.xml"
<servlet>
<servlet-name>myservletajax</servlet-name>
<servlet-class>MyServletAjax</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>myservletajax</servlet-name>
<url-pattern>/myServletAjax</url-pattern>
</servlet-mapping>
For read more information on Ajax:
http://www.roseindia.net/ajax/Thanks
Related Tutorials/Questions & Answers:
ajax display - Ajaxajax display I send request from
ajax page to servlet...
i got response from servlet to
ajax as a string..
i want to
display that string line...,
Code to solve the problem :
"mainpage.jsp"
Ajax To display suggestions in a text box - Ajax of Keyword to process page Using
Ajax.
4)After getting the response you
display...
AJAX!");
return;
}
var url="gethint.jsp";
url=url+"?
q="+str;
url=url...To
display suggestions in a text box Hi All,
I have a requirement
Advertisements
how to display the image in center - Ajaxhow to
display the image in center i want to dispaly the image as center of the screen using javascript..while i am clicking the button ..any one give me the code for this one
filter and display html table data using ajax - Ajaxfilter and
display html table data using ajax Hi
i am stuck up... calling the
ajax function called retrieveURL.from here goes to DisplayCategory.jsp
i want to
display the data retrieved from the session in a 2d array
AjaxAjax send the example to fetch the data from the server by using
ajax in java.
for ex:-if there are states which is used to
display in frontend we use
ajax.
send it to me
ajaxajax HI,
In my application using
ajax if i type a managername in the textbox it should
display all the employees under the that manager... on search button it should
display the employee details from database pls help
ajaxajax please describe the
ajax AjaxAjax How to learn
AJAX AjaxAjax Hi,
What is
Ajax? What is the use of
Ajax?
Thanks
Hi,
Ajax is set of technologies used to develop dynamic web applications. In
Ajax following technologies is used:
a) JavaScript
b) XML
c) HTTP
d) CSS
Learn
AjaxAjax how to impliment
ajax in registration table using jsp-servlet
AJAX - AjaxAJAX What is
AJAX?how we will use it in java?what is the use of
AJAX?give me example? hi friend,
Ajax plays a major role... characteristics have made it popular among the users to develop their site using
Ajax AjaxAjax how to include
ajax in jsp page?
Hi,
Please read
Ajax First Example - Print Date and Time example.ADS_TO_REPLACE_1
Instead of using PHP you can write your code in JSP.
Thanks
ajaxajax how to connect
ajax with mysql without using php,asp or any other scripting language.
please answer soon
Ajax - AjaxAjax What is
Ajax ? How one can use
ajax with Java
displaydisplay please tell me how to
display the content from database.. if we click on any image using servlets/jsp...please
ajaxajax I am facing following problem,
I am using
ajax to get... part. Here am using tag to
display the output.Whenever user clicks on the link...("
display").innerHTML=xmlHttp.responseText
Ajax ajax where instead of a link a radio button can fetch the data and can populate a table.If
ajax can be used,it would be a greater advantage.After fetching data
ajaxajax How can we fetch data in
ajax through servlet?
"mainpage.jsp"
<html>
<head>
<title>
Ajax Example</title>...;/head>
<body>
<h1 align="center"><font color="#000080">
Ajax ajaxajax How can we fetch data in
ajax through servlet?
"mainpage.jsp"
<html>
<head>
<title>
Ajax Example</title>...;/head>
<body>
<h1 align="center"><font color="#000080">
Ajax ajaxajax How can we fetch data in
ajax through servlet?
"mainpage.jsp"
<html>
<head>
<title>
Ajax Example</title>...;/head>
<body>
<h1 align="center"><font color="#000080">
Ajax ajaxajax How can we fetch data in
ajax through servlet?
"mainpage.jsp"
<html>
<head>
<title>
Ajax Example</title>...;/head>
<body>
<h1 align="center"><font color="#000080">
Ajax Ajax options.
I want to do it using
ajax.
My table is
CREATE TABLE HT<em>
AJAX ajax.
My table is CREATE TABLE HTNEWMETER ( ID NUMBER (10) NOT NULL, METERNO
AJAX - AjaxAJAX what is
Ajax?WHAT IS THE USAGE OF IT?WHERE WE HAVE TO USE IT?
GIVE ME EXPLANATION WITH EXAMPLE? Hi friend,
Ajax :
Asynchronous JavaScript and XML or
Ajax for short is new web development technique used
ajax - Ajaxajax Hi all,
I want
ajax validation in struts1.0 , I tried from many days but, i cound't find solution.. I am attaching my code here.
struts... ("Your browser does not support
Ajax HTTP");
return;
}
var s
ajax - Ajaxajax Dear Roseindia,
I want small application using
ajax validation in struts1 login. I tried from many days but, i coudn't get solution..Do some favour me..it's urgent.
Thanqs for advance.
Hi
ajax - Ajaxajax how getting corresponding values from database when we select one option in selection box the result
display on either a select box or text box
Ajax Dropdown display values in german language
using DWRUtil Parameter values in
ajax.
Only
display should be in german but, values internally work same...
Ajax Dropdown hi
I have One Dropdown that contains 2 options assume
Ajax - Ajax that :
form1.html where all
Ajax code is written :
function showHint...){
alert ("Your browser does not support
AJAX!");
return
ajax programmingAjax Programming
What is
Ajax Programming?
Asynchronous JavaScript and XML briefly known as
Ajax is
used to interchange the data with the server... is based on the
HTML, Java Script, CSS, and XML.
Why
Ajax Programming?
When you
AJAX - Ajax ("Your browser does not support
AJAX!");
return;
}
var url="http://localhost
AJAX Example
AJAX Example
In the following example we will see how to
display server IP address
dynamically with the help of
AJAX, HTML, & PHP.
SimpleAjax.htmlADS_TO_REPLACE_1
<html>
Ajax Registration Program
Ajax Registration Program
In this
Ajax Registration
program you will learn how to validate the user registration through
ajax
call and then
display the alert
Ajax methodAjax method there is registratinon form with name,address,email id... then states of india should
display and depending upon that state,city should
display. thism should be done using
ajax,html,javascript.
And xml should contain data
Ajax methodAjax method there is registratinon form with name,address,email id... then states of india should
display and depending upon that state,city should
display. thism should be done using
ajax,html,javascript.
And xml should contain data
AJAX with
AJAX with
Ajax resources, in a digg style, allows the user to register and addd his/her
own links
Read full DescriptionADS_TO_REPLACE_1
What is ajax? - AjaxWhat is
ajax? What is
Ajax Programming? Can any one share the basic examples of it? thanks
displaying - Ajaxdisplaying hi..
im sending request from
ajax page to servlet ..as in response i need the get the from database to servlet and from servlet to
ajax in column wise..
i have to
display the response column wise in the same
Ajax Learner - AjaxAjax Learner Hi,
This is Ziaul,I am working as Java/j2ee Developer from last one year.
i have to use
Ajax for my current project.pls guide me how should i proceed to learn
Ajax.
Thanks and Regards
Ziaul Hauqe Siddique
Ajax validation - AjaxAjax validation how to validate a form using
Ajax and php ... you.
Please visit for more informaton:
http://www.roseindia.net/
ajax/ajaxlogin/
ajax-registration-program.shtml
Thanks.
Amardeep
Ajax Learner - AjaxAjax Learner Hi,
This is Ziaul,I am working as Java/j2ee Developer from last one year.
i have to use
Ajax for my current project.pls guide me how should i proceed to learn
Ajax.
Thanks and Regards
Ziaul Hauqe Siddique
ajax basics - Ajaxajax basics i need
ajax basics where can i find these........................
pls help me
thanx in advance Hi friend,
Ajax :
Asynchronous JavaScript and XML or
Ajax for short is new web development technique
Ajax form element - AjaxAjax form element I have problem in passing a value into form feild using
ajax. I want to get the value is as a parameter. Can some one help me plz
ajax in java - Ajaxajax in java Dear deepak sir,
My page contain several control... will come "Caseno exist"
Sir I am using
Ajax first-time.Please help me.
Hi friend,
Ajax :
Asynchronous JavaScript and XML or
Ajax for short
ajax with php - Ajaxajax with php how to do autocomplete search using
ajax wit php in object oriented format?..
data should me retrive from database.. plz the way?.. give some sample codings
Javascript & AJAX query - AjaxJavascript &
AJAX query Hi
This is Venu.I want the coding for
javascript i.e when i select a radio button it should
display a text box along... on the Addmore button it should
display a text box along with a button (name the button
Ajax typeAjax type hiii,
Is
Ajax a technology platform or is it an architectural style