Tuesday, March 10, 2009

How do I go from my applet to another JSP or HTML page (Applets)

Question :How do I go from my applet to another JSP or HTML page? (Applets)
Answer :Use AppletContext and invoke showDocument() on that context object.
Below is sample code
URL targetURL;
String URLString = "http://localhost:8080/mypage.jsp";
AppletContext context = getAppletContext();
try
{
targetURL = new URL(URLString);
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
context.showDocument(targetURL);

No comments: