?? echoservlet.java
字號:
import java.io.*;import javax.servlet.ServletException;import javax.servlet.http.*;/** * Simple demonstration for an Applet <-> Servlet communication. */public class EchoServlet extends HttpServlet { /** * Get a String-object from the applet and send it back. */ public void doPost( HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { response.setContentType("application/x-java-serialized-object"); // read a String-object from applet // instead of a String-object, you can transmit any object, which // is known to the servlet and to the applet InputStream in = request.getInputStream(); ObjectInputStream inputFromApplet = new ObjectInputStream(in); String echo = (String) inputFromApplet.readObject(); // echo it to the applet OutputStream outstr = response.getOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(outstr); oos.writeObject(echo); oos.flush(); oos.close(); } catch (Exception e) { e.printStackTrace(); } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -