I have been searching on how to start an applet from a servlet. Everything on the web so far has been on the opposite, connecting to a servlet from an applet. I am writing a gwt/j2ee app and need to post data to a servlet, then have the servlet start an applet and pass serialized objects to the applet. The applet would then send data back the the servlet. Any ideas? Thanks in advance.
Share
You don’t and can’t start an applet with a Servlet. You just let the applet during its
init()call the servlet for any data the applet needs and have the servlet return the desired data. Applet-Servlet communication can be done with help of a HTTP client in the applet. The basic Java SE API offers youjava.net.URLandjava.net.URLConnectionfor this.Here,
servletURLshould match theurl-patternof the servlet as you definied in theweb.xml, e.g./servletURLor/servletURL/*.See also:
URLConnection