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

JQuery Ajax Java Example

 
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
For your PS: http://faq.javaranch.com/Watch/

Eric
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic