HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
My JSP 'index.jsp' starting pagemethod="POST" enctype="multipart/form-data">
value="上传">
新建Upload1Servlet 路径:/upload1
[java] view plain copy
package cn.itcast.web.servlet;
import java.io.IOException;
import java.io.InputStream;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Upload1Servlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// System.out.println("upload1 servlet......");
// 通过request获取一个字节输入流,将所有的请求正文信息读取到,打印到控制台