Re: opening a html page from applet
rajbala.3399@gmail.com wrote:
Andrew Thompson wrote:
rajbala.3399@gmail.com wrote:
...
...want to open a JSP page from applet
when mouse clicked on a image. But when I tried for it I got only
source code of that web page. Can you please help me.
Possibly - depends largely on you (and how much
you can help yourself).
Can you provide ..
- a URL to the web page with the broken applet
Where is the web page with the applet?
- a link, from that page, to the short, self contained code
being used for the applet.
....
Umm.. Ok, good attempt, but since you were discussing
JSP's and applets, it is a surprise to see a 'main(String[] args)',
which applies to neither. But I'll forge on..
(otherwise it was a nice, short, descriptive example.)
public class URL {
public static void main(String[] args) throws Exception {
URL yahoo = new URL("http://www.yahoo.com/");
.....
Do you have Yahoo's permission to access their
pages programmatically?
...But it get only html code
What was it you were expecting?
Try the same URL with this code..
<http://groups.google.com/group/comp.lang.java.programmer/msg/d4a724ad57cfadad>
...nothing else beyond that. But that is not my
requirement.
I want to get a JSP page when i click on applet.
You do realise that JSP becomes HTML once
served, right? If Yahoo uses JSP, and you request
an address from them, you will get HTML.
... I want sugesstion for
open a new window when ever i click on aplet.
applet.getAppletContext().showDocument(url, "_blank");
Note their are major issues with that approach,
and it sounds quite unlike what you have so far
attempted, but I still do not quite understand the
complete requirement.
If you want to access information in other pages
from within Java - the showDocument will not work.
If you simply want to show the end user a web
page - it will work well for some (though
'not at all' for others).
Andrew T.