File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes AJAX 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 "AJAX" Watch "AJAX" New topic
Author

AJAX

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Does any one have implemented AJAX (Asynchronous Javascript And XML)???

Can any one tell the basic logic behind it???

Thanks.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
There is plenty of information out there. Do a serch on Google for what you are looking for. AKA. Ajax Servlets / Ajax JSP / AJAX Double Combo / Etc.

Eric
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Ajax Servlets / Ajax JSP / AJAX Double Combo / Ajax In Action


[My Blog]
All roads lead to JavaRanch
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Thanks.

I know, I can get detailed material on net but I am looking for a basic idea in user friendly, simple language.

Vikrant Pandit
Ranch Hand

Joined: Mar 27, 2006
Posts: 245
Hi

Check out this Ajax Wiki


Vikrant Pandit
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I have an extremely simple demo which I can post, but unfortunately i do not have access to it at the moment. I'll try to post it in the next day or two.
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026

I'll try to post it in the next day or two.


That's so nice of you bartender.


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by David O'Meara:
I have an extremely simple demo which I can post, but unfortunately i do not have access to it at the moment. I'll try to post it in the next day or two.


Thank you so much David.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

http://demo.script.aculo.us/shop


Groovy
Brett McLaughlin
author
Ranch Hand

Joined: Sep 01, 2004
Posts: 30
OK, I can't resist... if you really are coming to Ajax completely new, then Head Rush Ajax is an ideal book. It takes you from ground zero to a well-rounded Ajax developer, and you'll get a really strong grounding in asynchrony, the role of the browser, data formats, etc. Check it out...

Sorry, self-promotion. But that was too much of a softball to resist :-)

Thanks
Brett


Series Editor, Head First<br />Author of <a href="http://www.amazon.com/exec/obidos/ASIN/0596102259/newinstance-20" target="_blank" rel="nofollow">Head Rush Ajax</a> and <a href="http://www.amazon.com/Head-First-Object-Oriented-Analysis-Design/dp/0596008678/ref=pd_bbs_sr_1/104-5348268-5670331?ie=UTF8&s=books&qid=1192568453&sr=8-1/newInstance-20" target="_blank" rel="nofollow">Head First OOA&D</a>
Sahul Yasin
Ranch Hand

Joined: Aug 28, 2002
Posts: 48
Hi,

I have recently implemented Ajax in my project. Really impressive.

In our portal server application, firing a "dynamic data request" from a portlet was refreshing the whole page & reloaded all the porlets in the portal server page.

By using Ajax, we simply retrieved the data without refreshing the whole page & that improved the system performance.

Regards.


Regards,<br />Yasin<br />SCJP,SCWCD,SCBCD
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Sorry, self-promotion

That is what the book promotion is for
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I emailed the demo to Rathi, but here is an extremely simple demo...

Servlet:
(Takes a request with a number, returns the number and a random number as xml)


Web page:
(clicking the link sends an asnch request, receives and decodes the response then pops the data in an alert box)


The 'net.js' is a modified version taken from Eric's book
Note you need to swap on_error and on_load and remove the underscore before it will work.


Hopefully you know how to join the three together

Enjoy,
Dave.
[ April 29, 2006: Message edited by: David O'Meara ]
Liyaquat Ali
Ranch Hand

Joined: Nov 16, 2005
Posts: 156
Hey this is really good, pretty usefull, I think I'll try it out...


Excuse me while I kiss the sky (Jimi Hendrix)
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Dave,

Can I ask why in the world are you checking
if (http_request.readyState == 4){(http_request.status == 200)

inside the function when the content loader does that before it calls the next step.

Eric
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Hey it was there when I copied it!
Do you have a recommendation of how it should be?

(Sorry, I copied the ContentLoader part from one of your examples. If you have a problem feel free to remove it)
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
The content loader does th check already for the 4 and 200. Look at contentLoader and you will see that. It does the check with the costant holding 4 and then looks for 300. If it is a match it calls your function that handles the request.

So you basically just need to remove the if statements in your code that are performing the same check. Only way that code will be called is it it is complete.

Eric
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Ah I see what you mean, it was being done in the ContentLoader and the callback method. I had missed that. Thanks
Linda Walters
Ranch Hand

Joined: Apr 30, 2005
Posts: 100
I have implemented an Ajax application to provide "lazy loading" of a tree-like structure that is part of the enterprise IT Service Management (ITSM) product on which I work. The actual JavaScript code is pretty simple because the XML that I get back from the backend server throught the web servlet is rather straight-forward and the DOM parsing features of JavaScript make short work of it. The web servlet side of things was pretty much just a pass through of the request from the browser to the backend server and then passing back the XML from the backend down to the browser.

Even when all laid out nice and pretty, with white space, well placed braces, one statement to a line, comments, etc. the JavaScript code is only about 750 lines.

It was much easier than I had expected.


<a href="http://labryssystems.net/pblog/index.php" target="_blank" rel="nofollow">Javaville Gazette</a><br />Non-cooperation with evil is a duty. -- Mahatma Gandhi
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: AJAX