dcsimg
ajax & applet
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   anu_b
Posted On:   Friday, September 14, 2007 08:06 AM

Hai,
How i can we call an ajax with in applet. suppose i want to get some value from server when i click on a button placed on applet. I don't want to call another page. so i decided to use ajax. the server will return a value and using that value some operation will be done in applet. how it can be possible with ajax with applet. expecting ur valuable comments
regards
anu

Re: ajax & applet

Posted By:   Robert_Lybarger  
Posted On:   Friday, September 14, 2007 08:49 AM

If you're wanting the applet's call to be async so it behaves like most ajax calls made directly from the browser itself, you'll probably wind up making an HttpConnection to the address in question, but doing this in another Thread. You'll have to arrange for the applet's main thread to be notified when this second thread gets back its answers -- there are a few ways to do this, and I'm not discussing the whole realm of threaded java code here. When you get the response back, you'll have to decide if you want to handle the raw text-based response or convert to an XML document object model; for the latter, you'll need to explicitly load up a DOM object somehow, either via direct java code, or via some nicer third party tools like dom4j or jdom (or ...).
About | Sitemap | Contact