aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes is that any sample code for Ajax which implement in jsp ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "is that any sample code for Ajax which implement in jsp ?" Watch "is that any sample code for Ajax which implement in jsp ?" New topic
Author

is that any sample code for Ajax which implement in jsp ?

Nakata kokuyo
Ranch Hand

Joined: Apr 13, 2005
Posts: 438
hi, good day, is there any simple sample code for ajax implementation in java environment ? for example, checking existing product code in database

thank you
Surya Kant
Ranch Hand

Joined: Mar 29, 2005
Posts: 104
Hope this would help you...

function validate(url)
{
if (window.ActiveXObject)
{
request = new ActiveXObject("Microsoft.XMLHTTP");
request.onreadystatechange = checkForResult;
if(request)
{
request.open("GET", url);
request.send();
}
}
}

function checkForResult()
{
// If req shows "loaded"
if (request.readyState == 4)
{
// if response is "OK"
if (request.status == 200)
{
//this is a response sent from server program
//get this reponse & do the operations accordingly
var response = request.responseText;
}
// Server not responding . It might have been stopped
else
{
//stopScripts('Server not Responding');
}
}
}

function setURL()
{
if(validatePass())
{
var url = form some url which u want send to server
validate(url);

}
}
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
Try DWR

http://getahead.ltd.uk/dwr

Very easy to use. You just include the libraries as explained, setup some classes in your server and do some configuration. In a few minutes you'll be able to call your classes' methods from JavaScript.

See this

http://getahead.ltd.uk/dwr/examples/address
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
surya mm,

your code is IE only......better make it work with all browsers!

Eric
Nakata kokuyo
Ranch Hand

Joined: Apr 13, 2005
Posts: 438
thanks all for warm reply and guidance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is that any sample code for Ajax which implement in jsp ?