I want to send send HashMap object to the applet that requested it. A servlet has that HashMap object. Is there a way I can do this ?
Applet ------requests HashMap object---->Servlet listens to this request
|
|
Servlet searches that HashMap Object
|
|
\ /
<--Finally Send this to applet------------ Servlet gets the HashMap object
I have made a connection to the servlet and my servlet also has the HashMap object,but I don’t know how to send it to the applet and I wonder if it can be sent !
I’m going to make use of some external libraries in order to answer your question: Google Gson and Apache IO Utils.
So you already have the HashMap in your Servlet and want to send it to the Applet:
And to receive it in your Applet:
And that’s it. It’s just a simple example but I hope you get something out of it.
Of course you could be doing it by hand instead of using external libraries, but this way is much easier.