Not sure I understand what your problem is.
Can you post the relevant parts of your code.
Main Topics
Browse All TopicsI am using showDocument() to connect to a different
URL from inside of my applet.
However if I go to a different Web site from the browser session where my applet is running the URL link is not working anymore.
I am getting NullPointer on AppletContext since environment has changed. How can I fix that?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
None of offered comments works for me.
I am giving more details.
I start IE and load my applet - applet1.
Within this applet there is an URL link:
try {
URL u = new URL(sURL);
URLConnection uconn = u.openConnection();
Object content = uconn.getContent();
myMain.pPasswordDialog.sAp
}
catch (MalformedURLException e) {}
catch (IOException e) {}
Here a long string "myMain.pPasswordDialog...
myAppletContext = getAppletContext();
resides.
This link works fine untill I try to switch to a different
website from the one where my applet1 is running.
It does not affect my applet1 - it runs fine (it is not
destroyed); however the URL link is not working anymore.
No, I am not getting any exception;
When I had getAppletContext().showDoc
in that long line, I was getting NullPointerException
on AppletContext; then I replaced it with the myAppletContext (the result of the getAppletContext() in
Applet class). Now it does nothing at all; on ActionPerformed it comes to that URL link and stops.
I assume that AppletContext has changed when I leave the page; I don't know how to restore/save it. As I said at the same time the parent apllet1 is not effected; it is functioning fine.
You problem maty be related to the following:
URL u = new URL(sURL);
URLConnection uconn = u.openConnection();
Object content = uconn.getContent();
myMain.pPasswordDialog.sAp
You don't think you need the middle two lines, you just need:
URL u = new URL(sURL);
myMain.pPasswordDialog.sAp
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- points to heyhey_ (11/07/2001 01:50AM PST)
Please leave any comments here within the
next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
girionis
Cleanup Volunteer
Business Accounts
Answer for Membership
by: sgomsPosted on 2001-11-06 at 13:11:03ID: 6623198
check out the example in http://java.sun.com/docs/b ooks/tutor ial/applet /appletson ly/ browser .html
this example allows u to go to any URL you wish to.