运行java小程序后是否重定向?
我在谷歌上搜索了一下,但没有找到答案。唯一接近我目标的是在X秒后使用元重定向,如下所示:运行java小程序后是否重定向?,java,redirect,applet-servlet,Java,Redirect,Applet Servlet,我在谷歌上搜索了一下,但没有找到答案。唯一接近我目标的是在X秒后使用元重定向,如下所示: <meta http-equiv="refresh" content="5;url=index2.html"> 我需要的是php或html代码,用于检测我的java小程序是否已在页面上运行,然后重定向到另一个文件地址 我该怎么做呢,有人能给我一个示例代码吗? 非常感谢,非常感谢您抽出时间。如果您希望从小程序中触发重定向,我将尝试使用。它可以这样使用: this.getAppletConte
<meta http-equiv="refresh" content="5;url=index2.html">
我需要的是php或html代码,用于检测我的java小程序是否已在页面上运行,然后重定向到另一个文件地址
我该怎么做呢,有人能给我一个示例代码吗?
非常感谢,非常感谢您抽出时间。如果您希望从小程序中触发重定向,我将尝试使用。它可以这样使用:
this.getAppletContext().showDocument(URL, "_parent");
如果要从小程序重定向,请编写以下代码:
import java.applet.*;
import java.awt.Graphics;
import java.net.MalformedURLException;
import java.net.URL;
public class AppletExample extends Applet
{
public void init() {
try {
getAppletContext().showDocument(new URL("http://www.google.com"), "_blank");//This is new tab/
getAppletContext().showDocument(new URL("http://www.google.com"), "_parent");//This is in the parent tab/
}
catch (MalformedURLException ex) {
System.out.println(ex.getMessage());
}
}
public void paint( Graphics g ) {
g.drawString("Go Google", 0,100);
}
}