This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes Applet Servlet communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Applet Servlet communication" Watch "Applet Servlet communication" New topic
Author

Applet Servlet communication

Sushant Kumar
Greenhorn

Joined: Feb 13, 2004
Posts: 1
how applet can fetch data from servlet which is stored in servlet in a 2D Array.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Sushant,
Welcome to JavaRanch. Write the output on an ObjectOutputStream from the Servlet. Similiar to this:

Then on the Applet:

Note that any objects placed on the stream must implement java.io.Serializable
I'm moving this to the Servlet Forum.
[ February 25, 2004: Message edited by: Michael Morris ]

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Prakash Dwivedi
Ranch Hand

Joined: Sep 28, 2002
Posts: 452
Apart from the mechanism mentioned by Michael, you can also use RMI and Socket Connection (if possible) for applet-servlet communication.


Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"
Harro deGouw
Greenhorn

Joined: Feb 23, 2004
Posts: 5
Using custom (raw) sockets requires special permissions, you'd have to sign the applet to get these permissions or change the security settings in the browser.
imho it's generally a better idea to use the first mechanism...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Applet Servlet communication