Ok, this is my Java file :
============================
import javax.swing.*;
class TestJava
{
public static void main (String args[])
{}
public String SendStr (String lStr)
{
return lStr + "!!!";
}
}
============================
And This is my HTML and Javascript code:
============================
<OBJECT ID="Test" height=0 width=0
CLASSID="CLSID:18F79884-E141-49E4-AB97-99FF47F71C9E" CODEBASE="TestJava.CAB" VIEWASTEXT>
</OBJECT>
<script language="Javascript">
var Installed;
Installed = false;
try
{
if (Test==null)
Installed = false;
else
Installed = true;
}
catch (e)
{
Installed = false;
}
alert ("Installed :- " + Installed);
TestStr = Test.SendStr("Basil")
alert (TestStr);
</script>
============================
Pleae is this correct ????
Quote:
quote:Originally posted by malar
i want to call java function from Javascript.
i will send a string from javascript to Java file.
********************
Ans :
<script language="javascript">
function call() {
document.form[0].action="loginAction.do?str=" + "HelloWorld";
document.form[0].submit();
}
</script>
********************
i will send a string from javascript to Java file and the Java will return for me the Same String follow by "!!!".
****************
Ans :
public LoginAction {
public execute() {
String str = (String)request.getParameter ("str");
str += "!!!";
...........
}
}
****************
|