wood burning stoves 2.0
The moose likes HTML, CSS and JavaScript and the fly likes Using AJAX with Swing applet 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 "Using AJAX with Swing applet" Watch "Using AJAX with Swing applet" New topic

Using AJAX with Swing applet

Praful Gupta
Ranch Hand

Joined: May 01, 2006
Posts: 70
Hey Guys ... i am new to AJAX and am still learning it. I have a swing GUI applet that basically pulls data from an XML string generated by another webapp. The applet refreshes the data every once in a while. Could i use AJAX here to refresh the data from that string?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
It seems that you are already doing AJAX, only that in your case the "J" is for Java, not JavaScript.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

Yes, it sounds like you could replace the heavy-weight applet with light-weight Ajax.

If the webapp you will be contacting is on a separate server, you'll need to employ the use of a server-side proxy to get around the Ajax security sandbox. Chapter 12 of the book covers this in detail when learing how to use Ajax with remote web service APIs like Yahoo! Maps, Google and Flickr.

[Asking smart questions] [About Bear] [Books by Bear]
Ted Goddard

Joined: Apr 10, 2007
Posts: 2
Originally posted by Praful Gupta:
Could i use AJAX here to refresh the data from that string?

You may also want to consider server-initiated rendering approaches, such as Ajax Push (with ICEfaces) or Reverse Ajax (with DWR). This allows an event on the server to trigger an update of the browser page without polling.
Malli Raman
Ranch Hand

Joined: Nov 07, 2001
Posts: 312
How the server push or comet is working. Since my customer is not interested in going for opensources(icefaces), is there any way can we implement the comet / server push functionality.

Thanks in advance.
I agree. Here's the link: http://aspose.com/file-tools
subject: Using AJAX with Swing applet
It's not a secret anymore!