This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
How can I have an applet that can request data from a server directly? I have a JApplet that displays some drawings made through AWT. I want to have some links on the drawing that can "lookup" data from the server, directly from the applet and return it. What choices do I have to accomplish this? Suggestions are appreciated. Thanks.
Well You can have those drawings put up in icons or labels and call mouseClicked events on the and have a method that sends request to some servlet on the server. The servlet then returns some data in string or Object form and the Applet then displays it in its assigned place. If that is an Object that server sends and applet reads, then you have to have the Class file of that Object too with the applet.
I can further help you if you tell me what you need...
Help gets you when you need it!
Joined: Apr 09, 2002
If I had a simple as possible example I could work from that. So basically a JApplet that (upon clicking a JButton) would make a call directly to the server, read a textfile with first name and last name in it, and display a popup with those 2 values in it. I've read about RMI but with RMI you would need to download a jar file onto the client (correct?) and that's not something I want to do (don't want to have people download additional requirements). I just want to have an app in JApplet app that resembles a html page that utilizes AJAX (i.e. doesn't need to refresh and can directly grab info from the server behind the scenes). Does that help? If you have any additional info I'd appreciate it if you could pass it along. Thanks for your post as well.
Joined: May 09, 2002
Well it is either JApplet or Ajax; not Applet and Ajax; got me?
Well that is easy to build.
Have a server response on your server side like Servlet...
Heard that JApplet can read file from that same url from which it is loaded. And I have worked on it too.
Read textfile from url through applet and display it.