java用servlet实现文件上传到数据库2009-03-1914:26index.jsp文件上传web.xmluploadservletUploadupload/servletUploadindex.jsplib:jspupload.jarjava:importjava.io.*;importjava.sql.*;importjavax.servlet.*;importjavax.servlet.http.*;importcom.jspsmart.upload.*;publicclassservletUploadextendsHttpServlet{privateServletConfigconfig;/***初始化Servlet*/finalpublicvoidinit(ServletConfigconfig)throwsServletException{this.config=config;}/***处理GET请求*/publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{PrintWriterout=response.getWriter();out.println("");out.println("");out.println("jspSmartUpload:ServletSample");out.println("");out.println("ThemethodoftheHTMLformmustbePOST.");out.println("");out.println("");}/***响应POST请求*/protectedvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{PrintWriterout=response.getWriter();out.println("");out.pr
1