Newsgroup: it.comp.java
Titolo: loading an HTML-file from an Applet

Hallo everybody,
I have the following question: (but before, please note that I am not at
all a JAVA-Expert, I have only some expierience with GUI-Handling)
I wrote myself a JAVA-Applet, which represents a kind of a
Navigator-Menu. That is, you get a list of MenuItems (lightweight
Components in a lightweight Containers...). Each MenuItem may contain
SubMenuItem down to a "SelectionItem". My NavigatorMenu presents a list
ISDN services, for each of them an graphical ASN1Encoder can be started.
The ASN1Encoders for the services are itself Applets in other
HTML-Files.
The problem for me now is, that I do not know how to make the
NavigatorApplet in my Main-HTML-Page load a selected
Service-Encoder-HTML file in the browser.
I would like to make the Browser load the HTML-file of the service
rather than to open a new Browser Window or GUI-Frame (or whatever)...
Please, tell me whether it is possible to do it and how, and what
possibilities I have....
Thank you very much in advance !
Best regards,
        Rainer Podlas

 (part deleted ..)


Hallo Sven,
first of all I want to thank you for your reply.
Regarding your question:
I plan to 1.) provide the source code of my graphical
Java-ASN1-Builder-Application in a package on our local WEB-server.
 2.) a manual how to use the interface of my package I will  provide as
HTML-File on our local WEB-Server, this file will also include "the"
NavigatorMenu-Applet from which I want to  load the HTML-Files in the same
Browser-window (one for each ASN.1 service containing HTML-description of the
service + graphical service applet)
 3.) the HTML-Files for the services shall also be located on our local
WEB-Server
That is, all my files are stored on the WEB-server. The Applet you have
written seem to fit. Would be very nice if you could tell me how you made it
(what API is required to realize it; I had a short look and found that for
JAVA-networking there exist some classes for sockets API and some for working
with URLs; but as I said I have only some expierience with the GUI so far)
Thank you very much in advance!
Best regards,
  Rainer


 .. stuff deleted

 I placed my files in a .www-directory. I.e ~myProject/.www/thisFile.html
(rest deleted)

Hallo Sven,
I guess I was to fast with my response. I found a method of the Applet-Class to get an
AppletContext-Object.
With this AppletContext I can work with the Browser (void showDocument(...); method.)
I have already played around and tried to get some examples how to use relative URLs
but I have not been successfull yet.
1.) The Navigator-Applet is stored e.g. on a local drive:
C:\ASN1Encoder\navigator.html
2.) The Service-Applets are stored in the same directory: C:\ASN1Encoder\service1.html
The Navigator-Applet contained in the navigator.html file gets the AppletContext by
calling "getAppletContext();". Then I should be able to call the "showDocument(..);"
method of the AppletContext-Object returned by "getAppletContext();" to make the
Browser load teh service1.html file, but...
I have already played with the different URL-constructors and "showDocument-Arguments"
but either I get the thrown Exception or "nothing" happens.
Can you tell me what Argument for showDocument or what constructor of URL-Class I
shall use, respectively !?
Thank you very much in advance !
Best regards,
        Rainer


 > (rest deleted)

Hallo Sven,
I was too stupid...
The reason for my failure was that I ran the applet in the appletviewer and when the applet
requested the HTML-Page (only a text) the appletviewer could not show it...
Sorry for that stupid mistake!
Best regards,
        Rainer