• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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);

}
}
 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
surya mm,

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

Eric
 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks all for warm reply and guidance
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic