首页 > 代码库 > jqm文件上传,上传图片,jqm的表单操作,jqm的ajax的使用,jqm文件操作大全,文件操作demo
jqm文件上传,上传图片,jqm的表单操作,jqm的ajax的使用,jqm文件操作大全,文件操作demo
这一方面,我也一直没有做过,今天就抽出了一点时间来学习一下。如今的演示样例已经ok了,我就给大家分享一下,希望对大家有帮助。
好吧。我们先看看效果截图吧:
还行吧,来看页面代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head><title>伪专家jqm文件上传</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"> <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> </head> <body> <div data-role="page"> <div data-role="header" data-position="fixed"> <h1>伪专家jqm文件上传</h1> </div> <div class="ui-content"> <p><b>如有疑问:请加qq群135430763,共同学习!在看看简单的servlet代码:。。</b></p> <p><b>如有疑问:请加qq群135430763,共同学习!
!
!
</b></p> <div class="file-box"> <form action="FileServlet" method="post" enctype="multipart/form-data" data-ajax="false"> <input type="file" name="fileField" id="fileField" /> <input type="submit" name="submit" class="btn" value="http://www.mamicode.com/上传" /> </form> </div> <p><b>如有疑问:请加qq群135430763。共同学习!!!
</b></p> <p><b>如有疑问:请加qq群135430763,共同学习。!!
</b></p> </div> <div data-role="footer" data-position="fixed"> <h1>伪专家jqm文件上传</h1> </div> </div> </body> </html>
package com.herman.jqm.servlet; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; /** * @see 上传图片或文件FileServlet * @author Administrator * @date 2014年6月23日10:00:39 */ public class FileServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * 默认构造函数 */ public FileServlet() { } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ @SuppressWarnings("unchecked") protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setChara
jqm文件上传,上传图片,jqm的表单操作,jqm的ajax的使用,jqm文件操作大全,文件操作demo