- Posted by: Muralidharan narayana
- Posted on: July 06 2000 07:53 EDT
Can anybody help me how to contact an particular servlet from its corresponding applet and to pass the applet parameters to the servlet.
- communication between servlet and applet by RAJEEV S on July 06 2000 09:37 EDT
- communication between servlet and applet by Nagarjuna KOtapati on July 20 2000 07:26 EDT
- communication between servlet and applet by George Anestis on July 21 2000 04:32 EDT
- how to compile and run by Anith prem on January 24 2001 22:32 EST
- Re: communication between servlet and applet by J Dev on September 09 2007 03:17 EDT
- Re: communication between servlet and applet by J Dev on September 25 2008 10:05 EDT
Go to the Link "http://archive.coreservlets.com/Chapter17.html"
rajeevsmcp at usa dot net
See the O'reily SERVLETS ....Comunication between Applet and Servlet
There is an excellent article at
It mainly refers to RMI but you can find what you ask for with minor modifications.
The main idea is that you create a stream between servlet and applet and you use Serialization for the communication.
kindly help me out how to compile and run the servler and have the link btn the html and servlet.
Here is the code which you can use to communication between applet and servlet/JSP following code can be used at applet side : /* *URL to servlet */ URL serverURL = new URL(servletPath); URLConnection connection = serverURL.openConnection(); /* * Connection will be used for both input and output */ connection.setDoInput(true); connection.setDoOutput(true); /* * Disable caching */ connection.setUseCaches(false); /* *connection will be used for transfaring serialized java objects. */ connection.setRequestProperty("Content-Type", "application/octet-stream"); ObjectOutputStream outputStream = new ObjectOutputStream(connection.getOutputStream()); outputStream.writeObject(request); outputStream.flush(); outputStream.close(); ObjectInputStream inputStream = new ObjectInputStream(connection.getInputStream()); response = (Map)inputStream.readObject(); inputStream.close(); Here response is the response Map returned from servlet. following code can be used in your servlet to send serializable objects to applet. write this code in doXXX method of servlet. ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream()); Map responseMap = new HashMap(); /* put watever objects you wants to return to applet. This objects must be serializable. responseMap.put("a", "a"); */ out.writeObject(responseMap); out.flush(); out.close(); response.setStatus(HttpServletResponse.SC_NO_CONTENT); SS http://www.jyog.com