-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Gingtao,

On 1/29/13 7:45 AM, qingtao peng wrote:
> I have built the apache-tomcat-7.0.32 server on my computer.My 
> operating system is Windows7.I place a html page named
> DbApplet.html under the directory of DbServlet in the webapps of
> the apache-tomcat-7.0.32 server .My DbApplet.htm code is as follow
> :
> 
> <html> <head> </head> <body> <center> <object
> codebase="http://localhost:8080/DbServlet/build/classes/servlet/";
> classid = "DbApplet.class"  width = "600" height = "600" name =
> "DbApplet"> </object> </center> </body> </html>
> 
> I have started the apache-tomcat-7.0.32 server.Then i type 
> http://localhost:8080/DbServlet/DbApplet.html in the field of the 
> address on the browser.I can open the page on the browser,but the 
> html page can not present the java Applet embedded in the page.I
> have encoded the java Applet and compiled it into the class named 
> DbApplet.class.I place it under  the directory of 
> DbServlet/build/classes/servlet in the directory of the webapps of 
> the apache-tomcat-7.0.32 server .Why can the page not present my
> java Applet.

The available online documentation is a bit murky these days. Oracle's
own documentation[1] does not explain how to tell the browser where
your code is (e.g. in a JAR file on the server). I suspect it should
be done this way:

<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93">
  <param name="codebase"
value="http://localhost:8080/DbServlet/build/classes/servlet/"; />
  <param name="code" value="DbApplet.class" />
</object>

You should ensure that the URL
http://localhost:8080/DbServlet/build/classes/servlet/DbApplet.class
actually returns something. If Tomcat refuses to serve that request,
you'll get nothing.

Also, Oracle says this only works with Microsoft Internet Explorer. An
online HOW-TO[2] (a bit dated) says that you can still use <object> in
other browsers, but the syntax is a little different:

<object classid="java:fully/qualified/class/name.class"
              type="application/x-java-applet">
  <param name="code" value="fully/qualified/class/name.class" />
[...]
</object>

I'm not sure why you have to specify the class name twice in there.
That page also shows you how to embed Java applets in such a way that
they will work in both MSIE and everywhere else. Oracle has similar
documentation in their page I referenced, though using a different
technique. You'll have to test in your target environment to see what
actually works for you.

Good luck,
- -chris

[1]
http://download.java.net/jdk8/docs/technotes/guides/jweb/applet/using_tags.html
[2]
http://depth-first.com/articles/2008/02/20/demystifying-java-applets-part-1-cross-browser-standards-compliant-pure-html-deployment-using-the-object-tag/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEICO0ACgkQ9CaO5/Lv0PAa3gCcD0QN+PjtpI5gWBulGW0A2kJu
5VAAoJJ1E/7o356crfZw5h3eAS6BZTw3
=Rftp
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to