Ravindra76
asked on
Generating HTML with JAVA script to add PARAMETER to Applet
History of problem.
Pass a Parameter to the Applet from server 1 to server 2 without any CGI PROGRAM
For example,
http://ip1/someCGI ( SERVER 1) program will call
http://ip2/index.html ( SERVER 2) with a parameter to applet names as SESSIONID
So index.html on SERVER2 to be modified on the fly so that
<PARAM name=SESSIONID value=?12345> if i call the URL
http://ip2/index.html?12345 from SERVER1.
Good Example:
Assume the test.html as follows.
<Script language=JavaScript>
function setParam(){
document.writeln("<param name=\"sessionkey\" value=\""+document.locatio n.search+" \">");
</Script>
<body onLoad="setParam();" >
IF You execute this code in your browser
http://yourip/test.html?12345
the output in the View Source in the IE Browser is
<param name="sessionkey" value="?12345">
CURRENT PROBBLEM:-
So to achieve my problem, Entire .html page to be written in Java Script as mentioned in the example.
It is the following page. ( It has Swing Enabled Code ).
Name it as index.html
<Script language=JavaScript>
function setParam(){
document.writeln("<HTML><H EAD>");
document.writeln("<SCRIPT LANGUAGE=JavaScript><!--") ;
document.writeln("var _info = navigator.userAgent; var _ns = false;");
document.writeln("var _ie = (_info.indexOf(\"MSIE\") > 0 && _info.indexOf(\"Win\") > 0 && _info.indexOf(\"Windows 3.1\") < 0);");
document.writeln("--></SCR IPT>");
document.writeln("<SCRIPT LANGUAGE=JavaScript><!--") ;
document.writeln("if (_ie == true) document.writeln('<OBJECT classid=\"clsid:8AD9C840-0 44E-11D1-B 3E9-00805F 499D93\" WIDTH = 700 HEIGHT = 500 codebase=\"http://java.sun.com/products/plugin/1.1.2/jinstall-112-win32.cab#Version=1,1,2,0\"><NOEMBED><XMP >');");
document.writeln("else if (_ns == true) document.writeln('<EMBED type=\"application/x-java- applet;ver sion=1.1.2 \" java_CODE = \"App.class\" java_codebase = \"http://101.10.22.171/WEB-INF/classes\" WIDTH = 700 HEIGHT =500 pluginspage=\"http://java.sun.com/products/plugin/1.1.2/plugin-install.html\"><NOEMBED>< XMP>');");
document.writeln("--></SCR IPT>");
document.writeln("<Applet width=700 height=500 id=Applet1></XMP>");
document.writeln("<PARAM NAME = CODE VALUE = App.class>");
document.writeln("<ParaM Name = CODEBASE VALUE = \"http://101.10.12.171/WEB-INF/classes/\">");
document.writeln("<PARAM NAME = logPort VALUE = 8000 />");
document.writeln("<PARAM NAME= type VALUE=application/x-java-a pplet;vers ion=1.1.2> ");
document.writeln("<param name=\"sessionkey\" value=\""+document.locatio n.search+" \">");
document.writeln("</Applet >");
document.writeln("</NOEMBE D></EMBED> </OBJECT>" );
document.writeln("</HEAD>" );
}
</Script>
<body onLoad="setParam();">
I need error free version of above html page.
The errors i am facing:
1.Unterminated String in the line
A. document.writeln("var _ie = (_info.indexOf(\"MSIE\") > 0 && _info.indexOf(\"Win\") > 0 && _info.indexOf(\"Windows 3.1\") < 0);");
B. document.writeln("else if (_ns == true) document.writeln('<EMBED type=\"application/x-java- applet;ver sion=1.1.2 \" java_CODE = \"App.class\" java_codebase = \"http://101.10.22.171/WEB-INF/classes\" WIDTH = 700 HEIGHT =500 pluginspage=\"http://java.sun.com/products/plugin/1.1.2/plugin-install.html\"><NOEMBED>< XMP>');");
2. Object expected in the line
<body onLoad="setParam();">
Please fix these three bugs.
NOTE: NO LIVE CONNECT . ONLY SIMPLE JAVA SCRIPT ...............
Advanced Thanks
Pass a Parameter to the Applet from server 1 to server 2 without any CGI PROGRAM
For example,
http://ip1/someCGI ( SERVER 1) program will call
http://ip2/index.html ( SERVER 2) with a parameter to applet names as SESSIONID
So index.html on SERVER2 to be modified on the fly so that
<PARAM name=SESSIONID value=?12345> if i call the URL
http://ip2/index.html?12345 from SERVER1.
Good Example:
Assume the test.html as follows.
<Script language=JavaScript>
function setParam(){
document.writeln("<param name=\"sessionkey\" value=\""+document.locatio
</Script>
<body onLoad="setParam();" >
IF You execute this code in your browser
http://yourip/test.html?12345
the output in the View Source in the IE Browser is
<param name="sessionkey" value="?12345">
CURRENT PROBBLEM:-
So to achieve my problem, Entire .html page to be written in Java Script as mentioned in the example.
It is the following page. ( It has Swing Enabled Code ).
Name it as index.html
<Script language=JavaScript>
function setParam(){
document.writeln("<HTML><H
document.writeln("<SCRIPT LANGUAGE=JavaScript><!--")
document.writeln("var _info = navigator.userAgent; var _ns = false;");
document.writeln("var _ie = (_info.indexOf(\"MSIE\") > 0 && _info.indexOf(\"Win\") > 0 && _info.indexOf(\"Windows 3.1\") < 0);");
document.writeln("--></SCR
document.writeln("<SCRIPT LANGUAGE=JavaScript><!--")
document.writeln("if (_ie == true) document.writeln('<OBJECT classid=\"clsid:8AD9C840-0
document.writeln("else if (_ns == true) document.writeln('<EMBED type=\"application/x-java-
document.writeln("--></SCR
document.writeln("<Applet width=700 height=500 id=Applet1></XMP>");
document.writeln("<PARAM NAME = CODE VALUE = App.class>");
document.writeln("<ParaM Name = CODEBASE VALUE = \"http://101.10.12.171/WEB-INF/classes/\">");
document.writeln("<PARAM NAME = logPort VALUE = 8000 />");
document.writeln("<PARAM NAME= type VALUE=application/x-java-a
document.writeln("<param name=\"sessionkey\" value=\""+document.locatio
document.writeln("</Applet
document.writeln("</NOEMBE
document.writeln("</HEAD>"
}
</Script>
<body onLoad="setParam();">
I need error free version of above html page.
The errors i am facing:
1.Unterminated String in the line
A. document.writeln("var _ie = (_info.indexOf(\"MSIE\") > 0 && _info.indexOf(\"Win\") > 0 && _info.indexOf(\"Windows 3.1\") < 0);");
B. document.writeln("else if (_ns == true) document.writeln('<EMBED type=\"application/x-java-
2. Object expected in the line
<body onLoad="setParam();">
Please fix these three bugs.
NOTE: NO LIVE CONNECT . ONLY SIMPLE JAVA SCRIPT ...............
Advanced Thanks
ASKER
Still compilation errors;
Line 8: Unterminated String Constant
Line 32 : Object expected
Line 8: Unterminated String Constant
Line 32 : Object expected
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<html>
<head>
<title>Untitled Document</title>
</head>
<Script language=JavaScript>
function setParam(){
var _info = navigator.userAgent;
var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
var _ns = !_ie;
if (_ie == true) {
document.writeln("<OBJECT classid=\"clsid:8AD9C840-0
}
else if (_ns == true) {
document.writeln("<EMBED type=\"application/x-java-
}
document.writeln("<Applet width=700 height=500 id=Applet1></XMP>");
document.writeln("<PARAM NAME = CODE VALUE = App.class>");
document.writeln("<ParaM Name = CODEBASE VALUE = \"http://101.10.12.171/WEB-INF/classes/\">");
document.writeln("<PARAM NAME = logPort VALUE = 8000 />");
document.writeln("<PARAM NAME= type VALUE=application/x-java-a
document.writeln("<param name=\"sessionkey\" value=\"" + document.location.search + "\">");
document.writeln("</Applet
document.writeln("</NOEMBE
document.writeln("</HEAD>"
return true;
}
</Script>
<body onLoad="return setParam();">
</body>
</html>
Hope this helps
^_^