注:eclipse 开发工具  <context:component-scan base-package="com.zhouwuji.controller"></context:component-scan> 加入后 controller包的控制类会有S符好

commons io 和commons upload 开发

FTP服务器创建和上下传文件(3)

httpclient调用代码

package com.zhouwuji.controller;import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.Iterator;
import java.util.Map;import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.apache.commons.io.FileUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;@Controller
public class FileController {@RequestMapping("/download.do")public void doMain(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {//得到要下载的文件名String fileName =request.getParameter("filename"); System.out.println("fileName:"+fileName.trim());//23239283-92489-阿凡达.avi// fileName="zhangruan.txt";// fileName = new String(fileName.getBytes("iso8859-1"),"UTF-8");//上传的文件都是保存在/WEB-INF/upload目录下的子目录当中String fileSaveRootPath=request.getServletContext().getRealPath("/WEB-INF/upload");//得到要下载的文件File file = new File(fileSaveRootPath + "\\" + fileName);//如果文件不存在if(!file.exists()){request.setAttribute("message", "您要下载的资源已被删除!!");request.getRequestDispatcher("/fail.jsp").forward(request, response);return;}//处理文件名String realname = fileName.substring(fileName.indexOf(".")+1);//设置响应头,控制浏览器下载该文件response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(realname, "UTF-8"));//读取要下载的文件,保存到文件输入流
          FileInputStream in = new FileInputStream(file);//创建输出流OutputStream out = response.getOutputStream();//创建缓冲区byte buffer[] = new byte[1024];int len = 0;//循环将输入流中的内容读取到缓冲区当中while((len=in.read(buffer))>0){//输出缓冲区的内容到浏览器,实现文件下载out.write(buffer, 0, len);}System.out.println("下载成功");//关闭文件输入流
        in.close();//关闭输出流
        out.close();}@RequestMapping("/upload.do")   //@RequestParam("uploadfile")
    @ResponseBodypublic String queryFileData(@RequestParam("uploadfile")CommonsMultipartFile file,HttpServletRequest request){System.out.println("+++++++++++++++++"+request.getParameter("username"));/*MultipartFile是对当前上传的文件的封装,* 当同时上传多个文件时,可以给定多个MultipartFile参数(数组)*/if(file!=null){System.out.println("文件对象接到了!");//获取文件名String filename=file.getOriginalFilename();//获取上传路径String path=request.getSession().getServletContext().getRealPath("/WEB-INF/upload/"+filename.trim());System.out.println("path:"+path);//创建文件流并指定写入路径File destFile=new File(path);//springmvc的方式//该方法自动操作,不需要额外的去关闭IO流//复制临时文件到指定文件夹下try {FileUtils.copyInputStreamToFile(file.getInputStream(), destFile);System.out.println("上传成功");return "/success.jsp";} catch (IOException e) {e.printStackTrace();System.out.println("上传失败");return "/error.jsp";}}else{System.out.println("文件没有对象接到了!");return "/error.jsp";}}}
/*文件对象接到了!
filename:中软笔记.txt
path:D:/apache-tomcat-7.0.82-windows-x64/apache-tomcat-7.0.82/webapps/project-ajaxjson/upload/中软笔记.txt
上传成功*/

FileController

package com.zhouwuji.controller;import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;import javax.servlet.http.HttpServletRequest;import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;import com.zhouwuji.util.EncryptUtil;@Controller
public class LoginController {@RequestMapping("/json.do")@ResponseBodypublic  List<User> login(HttpServletRequest request) throws Exception{String  username=request.getParameter("username");String  password=request.getParameter("password");// key 为解密密钥String   key=request.getParameter("key");if (username !=null && password !=null ) {System.out.println("username:"+EncryptUtil.decrypt(username, key));System.out.println("password:"+EncryptUtil.decrypt(password, key));}if (key==null) {key="LmMGStGtOpF4xNyvYt54EQ==";}List<User> users=new ArrayList<User>();users.add(new User(1, EncryptUtil.encrypt("张三",key), "男"));users.add(new User(2, EncryptUtil.encrypt("李四",key), "男"));users.add(new User(3, EncryptUtil.encrypt("西施",key), "女"));return users;}
}

LoginController

package com.zhouwuji.controller;public class User {private int id;private String name;private String sex;public int getId() {return id;}public void setId(int id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getSex() {return sex;}public void setSex(String sex) {this.sex = sex;}public User(int id, String name, String sex) {super();this.id = id;this.name = name;this.sex = sex;}public User() {super();}}

User

package com.zhouwuji.util;import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;  import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;  import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;  /** * 功能描述  DES+MD5 加密工具类* 加密常用类 */
public class EncryptUtil {  // 密钥是16位长度的byte[]进行Base64转换后得到的字符串  // public static String key = "LmMGStGtOpF4xNyvYt54EQ==";  /** * <li> * 方法名称:encrypt</li> <li> * 加密方法 * @param xmlStr *            需要加密的消息字符串 * @return 加密后的字符串 */  public static String encrypt(String xmlStr,String key) {  byte[] encrypt = null;  try {  // 取需要加密内容的utf-8编码。  encrypt = xmlStr.getBytes("utf-8");  } catch (UnsupportedEncodingException e) {  e.printStackTrace();  }  // 取MD5Hash码,并组合加密数组  byte[] md5Hasn = null;  try {  md5Hasn = EncryptUtil.MD5Hash(encrypt, 0, encrypt.length);  } catch (Exception e) {  e.printStackTrace();  }  // 组合消息体  byte[] totalByte = EncryptUtil.addMD5(md5Hasn, encrypt);  // 取密钥和偏转向量  byte[] key1 = new byte[8];  byte[] iv = new byte[8];  getKeyIV(key, key1, iv);  SecretKeySpec deskey = new SecretKeySpec(key1, "DES");  IvParameterSpec ivParam = new IvParameterSpec(iv);  // 使用DES算法使用加密消息体  byte[] temp = null;  try {  temp = EncryptUtil.DES_CBC_Encrypt(totalByte, deskey, ivParam);  } catch (Exception e) {  e.printStackTrace();  }  // 使用Base64加密后返回  return new BASE64Encoder().encode(temp);  }  /** * <li> * 方法名称:encrypt</li> <li> * 功能描述: *  * <pre> * 解密方法 * </pre> *  * </li> *  * @param xmlStr *            需要解密的消息字符串 * @return 解密后的字符串 * @throws Exception */  public static String decrypt(String xmlStr,String key) throws Exception {  // base64解码  BASE64Decoder decoder = new BASE64Decoder();  byte[] encBuf = null;  try {  encBuf = decoder.decodeBuffer(xmlStr);  } catch (IOException e) {  e.printStackTrace();  }  // 取密钥和偏转向量  byte[] key1 = new byte[8];  byte[] iv = new byte[8];  getKeyIV(key, key1, iv);  SecretKeySpec deskey = new SecretKeySpec(key1, "DES");  IvParameterSpec ivParam = new IvParameterSpec(iv);  // 使用DES算法解密  byte[] temp = null;  try {  temp = EncryptUtil.DES_CBC_Decrypt(encBuf, deskey, ivParam);  } catch (Exception e) {  e.printStackTrace();  }  // 进行解密后的md5Hash校验  byte[] md5Hash = null;  try {  md5Hash = EncryptUtil.MD5Hash(temp, 16, temp.length - 16);  } catch (Exception e) {  e.printStackTrace();  }  // 进行解密校检  for (int i = 0; i < md5Hash.length; i++) {  if (md5Hash[i] != temp[i]) {  // System.out.println(md5Hash[i] + "MD5校验错误。" + temp[i]);  throw new Exception("MD5校验错误。");  }  }  // 返回解密后的数组,其中前16位MD5Hash码要除去。  return new String(temp, 16, temp.length - 16, "utf-8");  }  /** * <li> * 方法名称:TripleDES_CBC_Encrypt</li> <li> * 功能描述: *  * <pre> * 经过封装的三重DES/CBC加密算法,如果包含中文,请注意编码。 * </pre> *  * </li> *  * @param sourceBuf *            需要加密内容的字节数组。 * @param deskey *            KEY 由24位字节数组通过SecretKeySpec类转换而成。 * @param ivParam *            IV偏转向量,由8位字节数组通过IvParameterSpec类转换而成。 * @return 加密后的字节数组 * @throws Exception */  public static byte[] TripleDES_CBC_Encrypt(byte[] sourceBuf,  SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception {  byte[] cipherByte;  // 使用DES对称加密算法的CBC模式加密  Cipher encrypt = Cipher.getInstance("TripleDES/CBC/PKCS5Padding");  encrypt.init(Cipher.ENCRYPT_MODE, deskey, ivParam);  cipherByte = encrypt.doFinal(sourceBuf, 0, sourceBuf.length);  // 返回加密后的字节数组  return cipherByte;  }  /** * <li> * 方法名称:TripleDES_CBC_Decrypt</li> <li> * 功能描述: *  * <pre> * 经过封装的三重DES / CBC解密算法 * </pre> *  * </li> *  * @param sourceBuf *            需要解密内容的字节数组 * @param deskey *            KEY 由24位字节数组通过SecretKeySpec类转换而成。 * @param ivParam *            IV偏转向量,由6位字节数组通过IvParameterSpec类转换而成。 * @return 解密后的字节数组 * @throws Exception */  public static byte[] TripleDES_CBC_Decrypt(byte[] sourceBuf,  SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception {  byte[] cipherByte;  // 获得Cipher实例,使用CBC模式。  Cipher decrypt = Cipher.getInstance("TripleDES/CBC/PKCS5Padding");  // 初始化加密实例,定义为解密功能,并传入密钥,偏转向量
        decrypt.init(Cipher.DECRYPT_MODE, deskey, ivParam);  cipherByte = decrypt.doFinal(sourceBuf, 0, sourceBuf.length);  // 返回解密后的字节数组  return cipherByte;  }  /** * <li> * 方法名称:DES_CBC_Encrypt</li> <li> * 功能描述: *  * <pre> * 经过封装的DES/CBC加密算法,如果包含中文,请注意编码。 * </pre> *  * </li> *  * @param sourceBuf *            需要加密内容的字节数组。 * @param deskey *            KEY 由8位字节数组通过SecretKeySpec类转换而成。 * @param ivParam *            IV偏转向量,由8位字节数组通过IvParameterSpec类转换而成。 * @return 加密后的字节数组 * @throws Exception */  public static byte[] DES_CBC_Encrypt(byte[] sourceBuf,  SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception {  byte[] cipherByte;  // 使用DES对称加密算法的CBC模式加密  Cipher encrypt = Cipher.getInstance("DES/CBC/PKCS5Padding");  encrypt.init(Cipher.ENCRYPT_MODE, deskey, ivParam);  cipherByte = encrypt.doFinal(sourceBuf, 0, sourceBuf.length);  // 返回加密后的字节数组  return cipherByte;  }  /** * <li> * 方法名称:DES_CBC_Decrypt</li> <li> * 功能描述: *  * <pre> * 经过封装的DES/CBC解密算法。 * </pre> *  * </li> *  * @param sourceBuf *            需要解密内容的字节数组 * @param deskey *            KEY 由8位字节数组通过SecretKeySpec类转换而成。 * @param ivParam *            IV偏转向量,由6位字节数组通过IvParameterSpec类转换而成。 * @return 解密后的字节数组 * @throws Exception */  public static byte[] DES_CBC_Decrypt(byte[] sourceBuf,  SecretKeySpec deskey, IvParameterSpec ivParam) throws Exception {  byte[] cipherByte;  // 获得Cipher实例,使用CBC模式。  Cipher decrypt = Cipher.getInstance("DES/CBC/PKCS5Padding");  // 初始化加密实例,定义为解密功能,并传入密钥,偏转向量
        decrypt.init(Cipher.DECRYPT_MODE, deskey, ivParam);  cipherByte = decrypt.doFinal(sourceBuf, 0, sourceBuf.length);  // 返回解密后的字节数组  return cipherByte;  }  /** * <li> * 方法名称:MD5Hash</li> <li> * 功能描述: *  * <pre> * MD5,进行了简单的封装,以适用于加,解密字符串的校验。 * </pre> *  * </li> *  * @param buf *            需要MD5加密字节数组。 * @param offset *            加密数据起始位置。 * @param length *            需要加密的数组长度。 * @return * @throws Exception */  public static byte[] MD5Hash(byte[] buf, int offset, int length)  throws Exception {  MessageDigest md = MessageDigest.getInstance("MD5");  md.update(buf, offset, length);  return md.digest();  }  /** * <li> * 方法名称:byte2hex</li> <li> * 功能描述: *  * <pre> * 字节数组转换为二行制表示 * </pre> *  * </li> *  * @param inStr *            需要转换字节数组。 * @return 字节数组的二进制表示。 */  public static String byte2hex(byte[] inStr) {  String stmp;  StringBuffer out = new StringBuffer(inStr.length * 2);  for (int n = 0; n < inStr.length; n++) {  // 字节做"与"运算,去除高位置字节 11111111  stmp = Integer.toHexString(inStr[n] & 0xFF);  if (stmp.length() == 1) {  // 如果是0至F的单位字符串,则添加0  out.append("0" + stmp);  } else {  out.append(stmp);  }  }  return out.toString();  }  /** * <li> * 方法名称:addMD5</li> <li> * 功能描述: *  * <pre> * MD校验码 组合方法,前16位放MD5Hash码。 把MD5验证码byte[],加密内容byte[]组合的方法。 * </pre> *  * </li> *  * @param md5Byte *            加密内容的MD5Hash字节数组。 * @param bodyByte *            加密内容字节数组 * @return 组合后的字节数组,比加密内容长16个字节。 */  public static byte[] addMD5(byte[] md5Byte, byte[] bodyByte) {  int length = bodyByte.length + md5Byte.length;  byte[] resutlByte = new byte[length];  // 前16位放MD5Hash码  for (int i = 0; i < length; i++) {  if (i < md5Byte.length) {  resutlByte[i] = md5Byte[i];  } else {  resutlByte[i] = bodyByte[i - md5Byte.length];  }  }  return resutlByte;  }  /** * <li> * 方法名称:getKeyIV</li> <li> * 功能描述: *  * <pre> *  * </pre> * </li> *  * @param encryptKey * @param key * @param iv */  public static void getKeyIV(String encryptKey, byte[] key, byte[] iv) {  // 密钥Base64解密  BASE64Decoder decoder = new BASE64Decoder();  byte[] buf = null;  try {  buf = decoder.decodeBuffer(encryptKey);  } catch (IOException e) {  e.printStackTrace();  }  // 前8位为key  int i;  for (i = 0; i < key.length; i++) {  key[i] = buf[i];  }  // 后8位为iv向量  for (i = 0; i < iv.length; i++) {  iv[i] = buf[i + 8];  }  }  public static void main(String[] args) throws Exception {  System.out.println(encrypt("欧长璐","LmMGStGtOpF4xNyvYt54EQ=="));  System.err.println(decrypt("BYyD3pQ9rYonhg9bbbXp3UzZYMGkgmJt8G9NIg1EZ3I=","LmMGStGtOpF4xNyvYt54EQ=="));}
} 

EncryptUtil DES、MD5 加密工具类

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%@  taglib  uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>值:${ad}
</body>
</html>

index.jsp

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"xmlns:mvc="http://www.springframework.org/schema/mvc"xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsdhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"><bean id="stringConverter"class="org.springframework.http.converter.StringHttpMessageConverter"><property name="supportedMediaTypes"><list><value>text/plain;charset=UTF-8</value></list></property></bean><bean id="jsonConverter"class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"></bean><beanclass="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"><property name="messageConverters"><list><ref bean="stringConverter" /><ref bean="jsonConverter" /></list></property></bean><!-- 1.springMVC上传文件时,需要配置CommonsMultipartResolver处理器 --><bean id="multipartResolver"class="org.springframework.web.multipart.commons.CommonsMultipartResolver"><!-- 设置默认的编码格式 --><property name="defaultEncoding" value="UTF-8" /><property name="maxInMemorySize" value="10240" /> <!-- 最大内存大小 (10240) --><property name="uploadTempDir" value="/upload/" /> <!-- 上传后的目录名 (WebUtils#TEMP_DIR_CONTEXT_ATTRIBUTE) --><!-- 指定所上传文件的总的大小不能超过200kb, 注意maxUploadSize属性点 限制 不是针对单个文件, 而是所有文件的容量总和 --><property name="maxUploadSize" value="-1" /><!-- 最大文件大小,-1为无限止(-1) --></bean><!-- 2.springMVC在超出上传文件限制时,会抛出 org.springframework.web.multipart.MaxUploadSizeExceededException 该异常时SpringMVC在检查上传文件信息时抛出来的,而且此时还没有进入到Controller方法中 --><bean id="exceptionResolver"class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"><property name="exceptionMappings"><props><!-- 在遇到MaxUploadSizeExceededException异常时,自动跳到xxx面 --><propkey="org.springframework.web.multipart.MaxUploadSizeExceededException">error.jsp</prop></props></property></bean><context:component-scan base-package="com.zhouwuji.controller"></context:component-scan>
</beans>

springmvc-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"><filter><filter-name>encoding</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>    <init-param><param-name>encoding</param-name><param-value>UTF-8</param-value></init-param></filter><filter-mapping><filter-name>encoding</filter-name><url-pattern>/*</url-pattern></filter-mapping><servlet><servlet-name>springmvc</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>springmvc</servlet-name><url-pattern>*.do</url-pattern></servlet-mapping><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list>
</web-app>

web.xml

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><base href="<%=basePath%>"><title>My JSP 'index.jsp' starting page</title><meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0">    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!--<link rel="stylesheet" type="text/css" href="styles.css">--></head><body>文件上传异常</body>
</html>

error.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><base href="<%=basePath%>"><title>My JSP 'index.jsp' starting page</title><meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0">    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!--<link rel="stylesheet" type="text/css" href="styles.css">--></head><body>文件上传失败</body>
</html>

fail.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%@  taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body><center><form action="<%=basePath%>upload.do" method="post"enctype="multipart/form-data"><input type="hidden" name="holly" value="holly" /> 上传文件:<inputtype="file" name="uploadfile"> <input type="submit"value="上传"></form><button id="btn" type="button">Click Me!</button><table width="80%" align="center"><tr><td>编号</td><td>姓名</td><td>性别</td></tr><tbody id="content"></tbody></table></center>
</body>
<script src="js/jquery-1.8.3.js" type="text/javascript"></script>
<script type="text/javascript">$(function() {$("#btn").click(function() {$.post("json.do", function(data) {var html = "";for (var i = 0; i < data.length; i++) {html += "<tr><td>" + data[i].id + "</td><td>"+ data[i].name + "</td><td>" + data[i].sex+ "</td></tr>";};$("#content").html(html);});});});
</script>
</html>

index.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><base href="<%=basePath%>"><title>My JSP 'index.jsp' starting page</title><meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0">    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!--<link rel="stylesheet" type="text/css" href="styles.css">--></head><body>文件上传成功</body>
</html>

success.jsp

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.zhouwuji.wuji</groupId><artifactId>project</artifactId><version>0.0.1-SNAPSHOT</version><packaging>war</packaging><dependencies><!-- https://mvnrepository.com/artifact/commons-logging/commons-logging --><dependency><groupId>commons-logging</groupId><artifactId>commons-logging</artifactId><version>1.1.1</version></dependency><!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc --><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>4.1.6.RELEASE</version></dependency><!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support --><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>4.1.6.RELEASE</version></dependency><!-- https://mvnrepository.com/artifact/jstl/jstl --><dependency><groupId>jstl</groupId><artifactId>jstl</artifactId><version>1.2</version></dependency><!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations --><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-annotations</artifactId><version>2.5.4</version></dependency><!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core --><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-core</artifactId><version>2.5.4</version></dependency><!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind --><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>2.5.4</version></dependency><dependency><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.4</version></dependency><dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId><version>1.2.2</version></dependency></dependencies></project>

pom.xml

转载于:https://www.cnblogs.com/ou-pc/p/8241771.html

java框架--springmvc --ajax-json-upload/download+maven+ DES/MD5 请求加密相关推荐

  1. Java框架 SpringMVC介绍及入门案例

    1.SpringMVC简介 1.1.什么是MVC MVC是一种软件架构的思想,将软件按照模型.视图.控制器来划分 M:Model ,模型层,指工程中的 JavaBean ,作用是处理数据 JavaBe ...

  2. Java框架-SpringMVC的应用(json数据交互、控制器方法返回值、文件上传)

    1. 搭建SpringMVC开发环境 1.1 创建项目,添加依赖 <?xml version="1.0" encoding="UTF-8"?> &l ...

  3. treegrid 与java交互_EXTJS实现的TREEGRID(后台java,框架SpringMVC)

    一.一些废话 近日来,有几个项目用到了EXTJS作为Web前端.也看到了一些童鞋苦苦在网上寻觅树形列表控件,碰巧项目中用到了一种,现在给大家分享一下. 二.前端 前端代码,用的是JS.主要就是指定数据 ...

  4. 微信小程序请求java后台 springmvc 获取json

    wx.request({url: 'https://www.fuhufuhu.com/dl',method: 'get',data: {latitude: wei.latitude,//longitu ...

  5. 自学Python第二十二天- Django框架(三) AJAX、文件上传、POST 请求类型之间的转换、多APP开发、iframe、验证码、分页器、类视图、中间件、信号、日志、缓存、celery异步

    Django官方文档 django 使用 AJAX django 项目中也可以使用 ajax 技术 前端 前端和其他 web 框架一样,需要注意的是,django 接收 POST 请求时,需要 csr ...

  6. java多图片上传json_[Java教程]SpringMVC框架五:图片上传与JSON交互

    [Java教程]SpringMVC框架五:图片上传与JSON交互 0 2018-08-07 22:00:42 在正式图片上传之前,先处理一个细节问题: 每一次发布项目,Tomcat都会重新解压war包 ...

  7. 468、Java框架122 -【Spring + SpringMVC + MyBatis - JSON】 2021.01.27

    目录 0.本知识点效果 1.jquery.min.js 2.json中文问题 3.CategoryController 4.submit.html 5.getOne.html 6.getMany.ht ...

  8. Java框架搭建-Maven、Mybatis、Spring MVC整合搭建

    Java框架搭建-Maven.Mybatis.Spring MVC整合搭建 1. 下载eclipse 到网站下载 http://www.eclipse.org/downloads/packages/e ...

  9. java获取作用域的值_Java-springMVC框架:springMVC取参数值、把值放入作用域方法

    Java-springMVC框架:springMVC取参数值.把值放入作用域方法 package com.zp.upload; import java.io.IOException; import j ...

  10. java后台框架 springmvc mybaits 集代码生成器 SSM SSH

    获取[下载地址]   QQ: 313596790   [免费支持更新] 支持三大数据库 mysql  oracle  sqlsever   更专业.更强悍.适合不同用户群体 [ 新录针对本系统的视频教 ...

最新文章

  1. srs推flv流_srs流媒体服务器(simple rtmp server)如何支持h265
  2. linux中重定向学习总结
  3. bzoj1407: [Noi2002]Savage
  4. Kafka解惑之Old Producer(4)——Case Analysis
  5. 用html实现网页版的拼图游戏,jQuery实现网页拼图游戏
  6. 这所985大学决定:404名硕博研究生,退学处理!
  7. oracle行列互换sql,解决Oracle行列转换问题的一个方法
  8. kaggle比赛——房价预测
  9. 获取原始NMEA 0183语句的方法
  10. 1一10到时的英文单词_[1-10的英语单词读音]1到10的英语单词
  11. ARCore学习——软件准备及网站
  12. Citrix桌面虚拟化基础搭建教程(持续更新)
  13. ESR-CMDS参数含义
  14. JavaSE + bluecove 蓝牙连接
  15. Elastic search常用分词 和 多字段搜索优化
  16. 感知系统性能评估分析解决方案
  17. 经济法基础——第三章第一节、支付结算概述
  18. Linux 搭建 discuz 论坛
  19. 基本数据类型和内置方法 08
  20. 堆积木 vector 清空内存

热门文章

  1. GitHub 标星 3.2w!史上最全技术人员面试手册!FackBoo发起和总结
  2. 程序员因太过耿直,致苹果官网出现bug......
  3. 清华软件工程硕士放弃百万年薪后,4年狂赚1100亿,却被央视点名批评!
  4. Python 运维中20个常用的库和模块,总有一个用的到~
  5. 技术人创业之心不死!
  6. tcp 四次挥手_TCP三次握手,四次挥手,你真的懂吗?
  7. mysql基础之mariadb对表中数据的增删改查
  8. 学习——java内存模型
  9. Task5.NB_SVM_LDA
  10. 用R语言实现对不平衡数据的四种处理方法