Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Swing / AWT / SWT and the fly likes how to implement Ajax with swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to implement Ajax with swing" Watch "how to implement Ajax with swing" New topic
Author

how to implement Ajax with swing

johny sill
Greenhorn

Joined: Jul 08, 2006
Posts: 27
HI,

Tell me how to implement AJAX(Asycronous Javascript And Xml) with swing,

Help me,

Thnaks in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41125
    
  45
The "J" in AJAX stands for JavaScript, which is indicative of this being a technology used in web pages. In Swing apps (where you have complete control over (a)synchronicity), and can access a server without the user doing anything at all times, there's no special significance to the term.

What are you trying to do?


Ping & DNS - my free Android networking tools app
johny sill
Greenhorn

Joined: Jul 08, 2006
Posts: 27
Hi,

Thanks for reply

i am trying open jsp from swing using



But i want to send some data to jsp and display it,Then i get some reponse(data, ex:ArrayList) from that jsp to swing

How it is ,

Thanks in advancve
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

How it is, is it's not going to happen. The JSP will send it's response to the server, not your Swing app.


GenRocket - Experts at Building Test Data
johny sill
Greenhorn

Joined: Jul 08, 2006
Posts: 27
Thanks for reply,

is there any other way,

Pls tell me,

Thaks in advance
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by johny sill:
Thanks for reply,

is there any other way,

Pls tell me,

Thaks in advance


Because JavaRanch is an international forum, many of our members are not native English speakers. For that reason, it's important that we all try to write clear, standard English, and avoid abbreviations and SMS shortcuts like Pls instead of Please. See here for more of an explanation. Thanks for understanding.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41125
    
  45
OK, so AJAX has nothing to do with this. There are two ways an applet (doesn't matter if it's Swing or AWT) can access web pages.

First, it can instruct the browser it's embedded in to show a particular URL in a frame. That's what the code you have does.

Second, it can access a URL which returns some data that the applet processes in order to display something. It sounds as if that's what you're trying to do. This FAQ wiki page talks about that.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

You can have your JSP write something to a database or filesystem that your Swing app connects to and gets the information.

It would help if you explained what kind of information your JSP is providing that your Swing app needs. Then we can provide better alternatives.
johny sill
Greenhorn

Joined: Jul 08, 2006
Posts: 27
i done with servlets it works fine,

but i want to display something in that web page and gets the response
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41125
    
  45
Gregg is right, you need to explain in more detail what you want to do. It's not clear to me how the interaction

web server <--> applet <--> web page

should work, and what kind of data flows from where to where.
johny sill
Greenhorn

Joined: Jul 08, 2006
Posts: 27
send arraylist to webpage from swing and get some data(arraylist) from database then send these two arraylists to it swing
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by johny sill:
send arraylist to webpage from swing and get some data(arraylist) from database then send these two arraylists to it swing


What is the role of the webpage in this workflow? Could you cut that part out and still get what you need from the database? What does the webpage do exactly. I think we're getting closer.

Thanks.
 
wood burning stoves
 
subject: how to implement Ajax with swing
 
Similar Threads
MVC pattern in Swing
AJAX
Any Tutorial to learn AJAX ?
CSS and Swing
Asynchronous client loader builder in WPF