Applet <-> Servlet communication

This example shows you, how to send data to a servlet from an applet and receive an answer. The servlet is an echo server, which simply sends back the string from the applet. The applet looks like this:

This is the complete source code:,, Tomcat's web.xml

All precompiled and tested with Tomcat: For installing, extract it under tomcat/webapps/echo and add to your tomcat/conf/server.xml the following line:

<Context path="/echo" docBase="echo" reloadable="true"/>

If you have installed Tomcat on your localhost, you can call the applet like this: http://localhost:8080/echo/index.html

5 . September 2002, Frank Buß