//MyApplet_1.java
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
public class MyApplet_1 extends Applet implements ActionListener{
Label log= new Label(\"Enter name\");
TextField lt = new TextField(20);
Label pw = new Label(\"Enter password\");
TextField p = new TextField(20);
Button login = new Button(\"Login\");
String name, password, urlString;
URL url;
public void init() {
add(log); add(lt); add(pw); add(p); add(login);
login.addActionListener(this);
}
public void start() {}
public void stop() {}
public void destroy() {}
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == login) {
name = lt.getText();
password =p.getText();
urlString
= \"
http://192.168.0.6/sr3su/LMarschoun/Applet/MyApplet_1rcvd.html ?nm=\";
urlString += name;
urlString += \"&pwd=\";
urlString += password;
try {
getAppletContext().showDocument(new URL (urlString));
}
catch (MalformedURLException ex) {
//do nothing
}
}
}
}
//MyApplet_2.java
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
public class MyApplet_2 extends Applet implements ActionListener{
Label log2= new Label(\"Enter name\");
TextField lt2 = new TextField(20);
Label pw2 = new Label(\"Enter password\");
TextField p2 = new TextField(20);
Button login2 = new Button(\"Login\");
String name2, password2, urlString2;
URL url2;
MyApplet_1 oa;
public void init() {
add(log2); add(lt2); add(pw2); add(p2); add(login2);
login2.addActionListener(this);
}
public void start() {}
public void stop() {}
public void destroy() {}
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == login2) {
MyApplet_1 oa = (MyApplet_1)getAppletContext().getApplet (\"MyApplet_1\");
name2 = oa.lt.getText();
password2 = oa.p.getText();
urlString2
= \"
http://192.168.0.6/sr3su/LMarschoun/Applet/MyApplet_1rcvd.html ?nm=\";
urlString2 += name2;
urlString2 += \"&pwd=\";
urlString2 += password2;
try {
getAppletContext().showDocument(new URL (urlString2));
}
catch (MalformedURLException ex) {
//do nothing
}
}
}
}
//MyApplet_12.html
<html>
<body>
<APPLET CODE=\"MyApplet_1.class\" NAME=\"MyApplet_1\"></APPLET>
<br><p>
<APPLET CODE=\"MyApplet_2.class\" NAME=\"MyApplet_2\"></APPLET>
</body>
</html>