We help IT Professionals succeed at work.
Get Started

stream a string to a browser from applet

dhenderson12
dhenderson12 asked
on
238 Views
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:

try
 {
     BufferedWriter out = new BufferedWriter(new FileWriter(sFileName));
     out.write(mo_Ap.getReport());
     out.close();
 }
 catch (IOException ie)
 {
   System.out.println(ie.getMessage());
 }

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

 }
 catch(MalformedURLException ue)
 {
   System.out.println(ue.getMessage());
 }

Any help appreciated.
Comment
Watch Question
CERTIFIED EXPERT
Distinguished Expert 2020
Commented:
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