import java.applet.Applet; import java.awt; import java.net.*; import java.io.*; public class sendApplet extends Applet { Lable sendlable; Lable messageinfor; Button sendButton; TextField messageText; TextField sendText; URLConnection connect; String message; public String getAppletInfo() { return "sendApplet - Applet to communicate with receiveServlet , Written by ding;"; } public synchronized void init() { super.init(); resize(500,300); sendlable = new Lable("Please Enter Massage"); messageInfor = new Lable("What you have send:"); sendButton = new Button("Send"); sendText = new TextField(40); messageText = new TextField(40); messageText.setEditable(false);
public class receiveservlet extends HttpServlet { public void service (HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException { res.setContentType("text/plain"); ServletOutputStream out = res.getOutputStream(); out.print("receive user message:"); out.print("req.getParameter("message")); }
public String getServletInfo() { return "return a String representation of the current time"; } }