Hi,
I have JSP with an applet embedded in it. The applet has a method called test(). In the JSP I have button called test. Now I need to call the method test on the click of the button in the JSP.
The JSP code is as follows.
<html>
<head>
<script type = "text/javascript" language = "javascript">
function testing()
{
alert("Hello"
}
</script>
</head>
<body>
<form name = "testing">
<input type = "submit" value = "test" onclick = "testing()">
<applet
codebase = " code = "Testing"
name = "TestApplet"
width = "200"
height = "200"
hspace = "10"
vspace = "10"
align = "bottom"
>
</form>
</body>
</html>
The Applet code is as follows
public class Testing extends Applet
{
String msg;
public void init()
{
setBackground(Color.cyan);
setForeground(Color.red);
msg = "Inside Init() --";
}
public void start()
{
msg += " Inside Start() --";
}
public void paint(Graphics g)
{
msg += "Inside Paint(). ";
g.drawString(msg, 10, 30);
System.out.println("Paint "
}
public void test()
{
System.out.println("Working"
}
}
I have JSP with an applet embedded in it. The applet has a method called test(). In the JSP I have button called test. Now I need to call the method test on the click of the button in the JSP.
The JSP code is as follows.
<html>
<head>
<script type = "text/javascript" language = "javascript">
function testing()
{
alert("Hello"
}
</script>
</head>
<body>
<form name = "testing">
<input type = "submit" value = "test" onclick = "testing()">
<applet
codebase = " code = "Testing"
name = "TestApplet"
width = "200"
height = "200"
hspace = "10"
vspace = "10"
align = "bottom"
>
</form>
</body>
</html>
The Applet code is as follows
public class Testing extends Applet
{
String msg;
public void init()
{
setBackground(Color.cyan);
setForeground(Color.red);
msg = "Inside Init() --";
}
public void start()
{
msg += " Inside Start() --";
}
public void paint(Graphics g)
{
msg += "Inside Paint(). ";
g.drawString(msg, 10, 30);
System.out.println("Paint "
}
public void test()
{
System.out.println("Working"
}
}