This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Servlets and the fly likes Hidden Applet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Hidden Applet?" Watch "Hidden Applet?" New topic

Hidden Applet?

Dave Donohoe
Ranch Hand

Joined: May 16, 2000
Posts: 73
I have a Servlet that calls an applet like so
output.writeBytes("<APPLET CODE='DavesApplet.class' ARCHIVE='DDavesApplet.jar' WIDTH=50 HEIGHT=50 CODEBASE='/BEAT/applet/'>");
The applet then uses an ObjectInputStream to connect to the servlet & get a Vector from the servlet. All this works fine except that the contents of the vector get printed to the screen. How can I leave the window in the browser blank? Ideally, I would prefer not to have the gray box of the applet appear either.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

In a properly written applet, the only way data - or anything else - is going to display is if the applet contains code to display it, so I have no idea why you have the first problem.
As to the second, Java was designed from the ground up with mischief-makers in mind, so normally a browser is not going to allow an applet to be totally invisible, either by explicit hiding or by the trick of putting it in a small (0x0 or 1x1) area - the idea is that the user should KNOW that there's active logic on the webpage. I believe that the JRE will actually refuse to start an applet if its physical display area is too small.

An IDE is no substitute for an Intelligent Developer.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
You can have an applet in a frame that is offscreen. Make a frameset where one member gets 100% of the screen and the other contains the applet.
I agree. Here's the link:
subject: Hidden Applet?
It's not a secret anymore!