Forums Register Login
Servlet can Call an Applet
My Question is when servlet call an applet like this
out.println("<applet code=xyz.class codebase=http://..... width=200 height=400></applet>")
is this works?? if yes kindly tell me where the xyz.class should placed or how should i call an applet class in servlet??
i have placed xyz.class file in the same directory as my servlet class file.
ie. http://url/servlet directory.
what path should i give it to call my applet in servlet.should it be
out.println("<applet code=xyz.class codebase=http://url/servlet/ width=200 height=400></applet>")
or if i place my applet xyz.class in html directory.then how should i give the path. since
both the ways are not working.
it is should applet load: class xyz not found
thanks in advance
1. Servlets don't call applets, servlets write HTML pages that have embedded applet tags.
2. Applet classes are loaded by applet rules NOT servlet rules. They are loaded by requests from the browser to the web server so the class files have to be where the web server can serve them. Servers are forbidden to serve files from WEB-INF.
3. A page written by a servlet should look just like a static HTML page when it gets to the browser.
you should start by creating a static page containing your applet and get that running. Then you can work on making your servlet write a page containing the applet tag.
In short you just have to use Http Tunneling.

Originally posted by j_kokil:
In short you just have to use Http Tunneling.

Hi Jignesh,
I am afraid we are not talking about HTTP tunneling here, are we Bill? This query was not about Applet-Servlet communication, the servlets simply creates an APPLET tag. HTTP tunneling is simply a way of bypassing firewall restrictions and enabling Java applets to communicate with the servers.
As I understand the use of the word, we are not talking about HTTP tunneling when a browser loads an applet by requesting class files from the server. Now, if the applet exchanges data with the server using a HttpURLConnection, I would call it tunneling.

This thread has been viewed 1484 times.

All times above are in ranch (not your local) time.
The current ranch time is
Sep 22, 2018 01:23:44.