wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes How to Open html page in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to Open html page in java" Watch "How to Open html page in java" New topic
Author

How to Open html page in java

nandhini sruthi
Greenhorn

Joined: Jan 11, 2008
Posts: 17
Hi,
I need help for how to open html page in new window while click the button in java.please give the solution.

Thanks in advance.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41064
    
  43
What does "clicking a button in java" mean? Is this a desktop application? An applet? Something else?

Should the web page be displayed in a browser or in the Java GUI?


Ping & DNS - my free Android networking tools app
nandhini sruthi
Greenhorn

Joined: Jan 11, 2008
Posts: 17
Hi,

I done some design in html page.In applet while click the button the html page should display in new window.That is in Either browser or Java GUI.

Thanks in advance.
Nathan Leniz
Ranch Hand

Joined: Nov 26, 2006
Posts: 132
Opening a new window in a browser is as simple as using some of the additional options in the <a href... block.

W3C tutorial


The very existence of flamethrowers proves that at some time, some where, some place, someone once said to themselves "I'd really like to set those people on fire over there, but I just can't get close enough".
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41064
    
  43
It's rather difficult to display a web page in a Java GUI, so let's stay with displaying it in the browser.

In the applet class you can call the "getAppletContext().showDocument(...)" method. If you pass it just a single parameter, the page will replace the current page (which contains the applet). If you want to display the page in a new window, you need to use the showDocument call that takes two parameters.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to Open html page in java
 
Similar Threads
redirect with button
Applets-----To------HTML page .....How?
How to throw open a html from a servlet which is called by another servlet ?
applet to applet communication
open an html file in excel