The test case below shows that a JSP called by Javascript in an HTML page with an applet opens behind the first browser window. This appears to be a regression in 1.4.0 - the test case works with 1.3.1_02 and 1.3.1_11, but does not work with 1.4.0, 1.4.0_04, 1.4.1_07, or 1.4.2_04. Note that if the plugin console window is shown instead of being hidden, the problem does not occur. Also note that the problem exists with both IE and Netscape.
Test case:
-------------------------------------------------------------------------------
mr_ie.htm:
------------
<HTML>
<HEAD>
<TITLE>Logon to WebFOCUS MRE</title>
<SCRIPT LANGUAGE="JavaScript">
function openHTMLTool()
{ var strURL = "";
strURL += "rpasstie.jsp";
var rptoolForm = document.getElementById("rptool");
rptoolForm.action = strURL;
rptoolForm.submit();
}
function ibilangtransonload()
{ alert("DEBUG");
var innerHTML = "<APPLET CODE='PanelTest2.class' MAYSCRIPT NAME='PanelTest2' ID='PanelTest2' HEIGHT=475 WIDTH=700>";
innerHTML += "</APPLET>";
document.getElementById("layerDomainAdmin").innerHTML = innerHTML;
return;
}
</script>
</head>
<BODY ONLOAD="ibilangtransonload()">
<DIV ID="layerDomainAdmin" STYLE="display=block"></div>
<DIV ID="layerHTMLRA" STYLE="display:none">
<FORM ID="rptool"
ACTION= base +"/javaassist/ibi/html/assist/jsp/rpasstie.jsp"
METHOD="post"
TARGET="rpWin">
</form>
</div>
</body>
</html>
------------------------------------------------------------------------------
PanelTest2.java:
-----------------
import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import netscape.javascript.JSObject;
import netscape.javascript.JSException;
public class PanelTest2 extends Applet{
Vector bloppo = new Vector();
JavaScript jscript;
public void init()
{
Button eButton = new Button("GOFORIT");
Panel center = new Panel();
center.add(eButton);
add(center);
jscript = new JavaScript(this);
System.out.println("Before call - watch for alert.");
jscript.call("openHTMLTool",bloppo);
System.out.println("After call ");
}
}// end of class
--------------------------------------------------------------------------------
JavaScript.java:
-----------------
import java.applet.Applet;
import java.applet.AppletContext;
import java.util.Vector;
import netscape.javascript.JSObject;
import netscape.javascript.JSException;
public class JavaScript extends Object {
private Applet applet;
private JSObject wind = null;
public JavaScript(Applet inApplet) {
this.applet = inApplet;
}
public boolean call(String functionName,Vector arguments) {
String [] args;
System.out.println("the function name is " + functionName);
JSObject window=null;
try {
window = JSObject.getWindow(applet);
JSObject doc = (JSObject)window.getMember("document");
JSObject loc = (JSObject) doc.getMember("location");
String s = (String)loc.getMember("href");
System.out.println("document.lication.href: " + s);
if (arguments == null) {
args=null;
}
else {
int size=arguments.size();
args=new String[size];
for (int index=0;index<size;index++) {
args[index]=(String) arguments.elementAt(index);
}
}
if(wind != null)
window = wind;
window.call(functionName,args);
if (false)
throw new netscape.javascript.JSException();
}
catch (netscape.javascript.JSException ex) {
println("Javascript exception");
println("Leaving 0001 call");
ex.printStackTrace();
return false;
}
catch (Exception ex) {
println("ComFailException exception"+ex.toString()+", calling: "+functionName);
println("window.toString()"+window.toString());
println("Leaving 0002 call");
return false;
}
return true;
}
private void println(String s) {
System.out.println("JavaScript: "+s);
}
}
---------------------------------------------------------------------------------------
rpasstie.jsp:
--------------
<%@ page language="java" contentType="text/html" %>
<HTML>
<HEAD>
<TITLE>THE JSP IN THE BACKGROUND</title>
</head>
<BODY
<TR><TD> I GOT BURIED.</td></tr>
</body>
</html>
###@###.### 2004-04-27
###@###.### 2004-04-28
###@###.### 2004-04-30