aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes JQuery Ajax Java Example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply locked New topic
Author

JQuery Ajax Java Example

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1034
I have the "Learning JQuery" book, which is quite good, but the Ajax examples are all in PHP.

Being a Java developer, I'm curious (based on the PHP examples) as to whether my Java class needs to be a Servlet (which it normally is with Ajax, right?) or if it can just be a "regular" server class???

Are there any books with Ajax examples using Java?

I can't readily find any good examples doing Google searches...

Thanks.

-- Mike

--------------

P.S. My JavaRanch account no longer gives me the option to get an automated email when somebody leaves a response to my posted messages. Don't know why this happened or how to fix.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
For your PS: http://faq.javaranch.com/Watch/

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60082
    
  65

Originally posted by Mike London:
Being a Java developer, I'm curious (based on the PHP examples) as to whether my Java class needs to be a Servlet (which it normally is with Ajax, right?) or if it can just be a "regular" server class???
How would your "regular" server class receive a request and return a response? So yes, your server-side Java needs to use servlets and/or JSP to accept the request (just as any other request made from a browser -- Ajax is no different) and return the response.

Are there any books with Ajax examples using Java?
The Ajax examples for my book on jQuery, jQuery in Action, are available in both Java (primarily JSP) and PHP.
[ July 16, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1034
Thanks Bear.

I realized the answer to the first part of your reply below right after I added the question to the forum. I was temporarily confused after looking at the PHP code.

-----

Sounds like I should also go out and get your JQuery book too.

Thanks very much for your kind replies!

Mike
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60082
    
  65

Just remember that Ajax requests are treated on the server no differently than other requests. I think that trips people up sometimes when they lose sight of that.

The difference comes in what the server-side resource returns (not how). Rather than full HTML pages -- as is usual for form submissions -- Ajax requests frequently return very different responses (JSON, HTML fragments, XML, and so on). But the mechanisms are exactly the same -- only the content differs.
[ July 16, 2008: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JQuery Ajax Java Example
 
Similar Threads
How to call server-side Java code from Ajax logif
JSP
Exception Handling while making Ajax calls
jQuery vs Dojo
what library you advice me to master, for building ajax applications?