Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
    Bookmark Topic Watch Topic
  • New Topic

JQuery Ajax Java Example

 
Mike London
Ranch Hand
Posts: 1192
4
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Report post to moderator
For your PS: http://faq.javaranch.com/Watch/

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
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 ]
 
Mike London
Ranch Hand
Posts: 1192
4
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
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 ]
 
    Bookmark Topic Watch Topic
  • New Topic