This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Applets and the fly likes Generating HTML page from Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Generating HTML page from Applet" Watch "Generating HTML page from Applet" New topic

Generating HTML page from Applet

Girma Tasew

Joined: Jul 26, 2007
Posts: 1
I have an Applet program that takes user input and display information on the Applet window. Is it possible to generate HTML page from within the applet to show the applet output in a web page separate from the Applet window?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41591
Welcome to JavaRanch.

Not directly. There are a few options for achieving something similar, though.
  • The applet can manipulate the DOM of the HTML it's embedded in (and possibly other frame son that page) through the Common DOM API. A link to that can be found in the Applet FAQ.
  • The applet could write an HTML file to the local hard disk, and have the browser open that file. It would need to be signed to do that (links about which can again be found in the Applet FAQ).
  • The applet could post the pertinent information to a server-side component (e.g. a servlet), and could then ask to the browser to display a new page off the server that incorporates that information.

  • Do any of these sound like they might do what you're looking for?

    Ping & DNS - my free Android networking tools app
    It is sorta covered in the JavaRanch Style Guide.
    subject: Generating HTML page from Applet