We help IT Professionals succeed at work.
Get Started

stream a string to a browser from applet

dhenderson12 asked
Last Modified: 2010-03-31
I have a java applet that gets a string containing html.  I need to stream this to a new browser window, which means using the getAppletContext() method.  At the moment, I write this string to a file on the pc (the applet is signed and is being allowed to do this), creating a new browser window with the getAppletContext, and giving it a URL of file:///c:/temp/myfile.html.  I would much prefer to stream the string to the browser, but I am totally stumped on how to do this.  

Here's what I'm doing now:

     BufferedWriter out = new BufferedWriter(new FileWriter(sFileName));
 catch (IOException ie)

   AppletContext browser = getAppletContext();
   browser.showDocument(new URL("file:///" + sFileName), "_blank");

 catch(MalformedURLException ue)

Any help appreciated.
Watch Question
Distinguished Expert 2020
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE