java里poi操作Excel工具类【我改】
参考原文:
https://www.cnblogs.com/yizhang/p/7244917.html
我改:
- package test;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.OutputStream;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- import org.apache.poi.hssf.usermodel.HSSFCell;
- import org.apache.poi.hssf.usermodel.HSSFDateUtil;
- import org.apache.poi.hssf.usermodel.HSSFFont;
- import org.apache.poi.hssf.usermodel.HSSFWorkbook;
- import org.apache.poi.ss.usermodel.Cell;
- import org.apache.poi.ss.usermodel.CellStyle;
- import org.apache.poi.ss.usermodel.DataFormat;
- import org.apache.poi.ss.usermodel.Font;
- import org.apache.poi.ss.usermodel.Row;
- import org.apache.poi.ss.usermodel.Sheet;
- import org.apache.poi.ss.usermodel.Workbook;
- import org.apache.poi.ss.util.CellRangeAddress;
- import org.apache.poi.xssf.usermodel.XSSFWorkbook;
- /**
- *
- * Excel 工具类
- *
- * @author zhangyi
- * @version 1.0 2016/01/27
- *
- */
- public class ExcelUtil {
- private Workbook workbook;
- private OutputStream os;
- private String pattern;// 日期格式
- public void setPattern(String pattern) {
- this.pattern = pattern;
- }
- public ExcelUtil(Workbook workboook) {
- this.workbook = workboook;
- }
- public ExcelUtil(InputStream is, String version) throws FileNotFoundException, IOException {
- if ("2003".equals(version)) {
- workbook = new HSSFWorkbook(is);
- } else {
- workbook = new XSSFWorkbook(is);
- }
- }
- public String toString() {
- return "共有 " + getSheetCount() + "个sheet 页!";
- }
- public String toString(int sheetIx) throws IOException {
- return "第 " + (sheetIx + 1) + "个sheet 页,名称: " + getSheetName(sheetIx) + ",共 " + getRowCount(sheetIx) + "行!";
- }
- /**
- *
- * 根据后缀判断是否为 Excel 文件,后缀匹配xls和xlsx
- *
- * @param pathname
- * @return
- *
- */
- public static boolean isExcel(String pathname) {
- if (pathname == null) {
- return false;
- }
- return pathname.endsWith(".xls") || pathname.endsWith(".xlsx");
- }
- /**
- *
- * 读取 Excel 第一页所有数据
- *
- * @return
- * @throws Exception
- *
- */
- public List<List<String>> read() throws Exception {
- return read(0, 0, getRowCount(0) - 1);
- }
- /**
- *
- * 读取指定sheet 页所有数据
- *
- * @param sheetIx
- * 指定 sheet 页,从 0 开始
- * @return
- * @throws Exception
- */
- public List<List<String>> read(int sheetIx) throws Exception {
- return read(sheetIx, 0, getRowCount(sheetIx) - 1);
- }
- /**
- *
- * 读取指定sheet 页指定行数据
- *
- * @param sheetIx
- * 指定 sheet 页,从 0 开始
- * @param start
- * 指定开始行,从 0 开始
- * @param end
- * 指定结束行,从 0 开始
- * @return
- * @throws Exception
- */
- public List<List<String>> read(int sheetIx, int start, int end) throws Exception {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- List<List<String>> list = new ArrayList<List<String>>();
- if (end > getRowCount(sheetIx)) {
- end = getRowCount(sheetIx);
- }
- int cols = sheet.getRow(0).getLastCellNum(); // 第一行总列数
- for (int i = start; i <= end; i++) {
- List<String> rowList = new ArrayList<String>();
- Row row = sheet.getRow(i);
- for (int j = 0; j < cols; j++) {
- if (row == null) {
- rowList.add(null);
- continue;
- }
- rowList.add(getCellValueToString(row.getCell(j)));
- }
- list.add(rowList);
- }
- return list;
- }
- /**
- *
- * 将数据写入到 Excel 默认第一页中,从第1行开始写入
- *
- * @param rowData
- * 数据
- * @return
- * @throws IOException
- *
- */
- public boolean write(List<List<String>> rowData) throws IOException {
- return write(0, rowData, 0);
- }
- /**
- *
- * 将数据写入到 Excel 新创建的 Sheet 页
- *
- * @param rowData
- * 数据
- * @param sheetName
- * 长度为1-31,不能包含后面任一字符: :\ / ? * [ ]
- * @return
- * @throws IOException
- */
- public boolean write(List<List<String>> rowData, String sheetName, boolean isNewSheet) throws IOException {
- Sheet sheet = null;
- if (isNewSheet) {
- sheet = workbook.createSheet(sheetName);
- } else {
- sheet = workbook.createSheet();
- }
- int sheetIx = workbook.getSheetIndex(sheet);
- return write(sheetIx, rowData, 0);
- }
- /**
- *
- * 将数据追加到sheet页最后
- *
- * @param rowData
- * 数据
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @param isAppend
- * 是否追加,true 追加,false 重置sheet再添加
- * @return
- * @throws IOException
- */
- public boolean write(int sheetIx, List<List<String>> rowData, boolean isAppend) throws IOException {
- if (isAppend) {
- return write(sheetIx, rowData, getRowCount(sheetIx));
- } else {// 清空再添加
- clearSheet(sheetIx);
- return write(sheetIx, rowData, 0);
- }
- }
- /**
- *
- * 将数据写入到 Excel 指定 Sheet 页指定开始行中,指定行后面数据向后移动
- *
- * @param rowData
- * 数据
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @param startRow
- * 指定开始行,从 0 开始
- * @return
- * @throws IOException
- */
- public boolean write(int sheetIx, List<List<String>> rowData, int startRow) throws IOException {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- int dataSize = rowData.size();
- if (getRowCount(sheetIx) > 0) {// 如果小于等于0,则一行都不存在
- sheet.shiftRows(startRow, getRowCount(sheetIx), dataSize);
- }
- for (int i = 0; i < dataSize; i++) {
- Row row = sheet.createRow(i + startRow);
- for (int j = 0; j < rowData.get(i).size(); j++) {
- Cell cell = row.createCell(j);
- cell.setCellValue(rowData.get(i).get(j) + "");
- }
- }
- return true;
- }
- /**
- *
- * 设置cell 样式
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @param colIndex
- * 指定列,从 0 开始
- * @return
- * @throws IOException
- */
- public boolean setStyle(int sheetIx, int rowIndex, int colIndex, CellStyle style) throws IOException {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- // sheet.autoSizeColumn(colIndex, true);// 设置列宽度自适应
- sheet.setColumnWidth(colIndex, 4000);
- Cell cell = sheet.getRow(rowIndex).getCell(colIndex);
- cell.setCellStyle(style);
- return true;
- }
- /**
- *
- * 设置样式
- *
- * @param type
- * 1:标题 2:第一行
- * @return
- */
- public CellStyle makeStyle(int type) {
- CellStyle style = workbook.createCellStyle();
- DataFormat format = workbook.createDataFormat();
- style.setDataFormat(format.getFormat("@"));// // 内容样式 设置单元格内容格式是文本
- style.setAlignment(CellStyle.ALIGN_CENTER);// 内容居中
- // style.setBorderTop(CellStyle.BORDER_THIN);// 边框样式
- // style.setBorderRight(CellStyle.BORDER_THIN);
- // style.setBorderBottom(CellStyle.BORDER_THIN);
- // style.setBorderLeft(CellStyle.BORDER_THIN);
- Font font = workbook.createFont();// 文字样式
- if (type == 1) {
- // style.setFillForegroundColor(HSSFColor.LIGHT_BLUE.index);//颜色样式
- // 前景颜色
- // style.setFillBackgroundColor(HSSFColor.LIGHT_BLUE.index);//背景色
- // style.setFillPattern(CellStyle.ALIGN_FILL);// 填充方式
- // font.setBold(true);
- font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);//粗体显示
- font.setFontHeight((short) 500);
- }
- if (type == 2) {
- font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);//粗体显示
- font.setFontHeight((short) 300);
- }
- style.setFont(font);
- return style;
- }
- /**
- *
- * 合并单元格
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @param firstRow
- * 开始行
- * @param lastRow
- * 结束行
- * @param firstCol
- * 开始列
- * @param lastCol
- * 结束列
- */
- public void region(int sheetIx, int firstRow, int lastRow, int firstCol, int lastCol) {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- sheet.addMergedRegion(new CellRangeAddress(firstRow, lastRow, firstCol, lastCol));
- }
- /**
- *
- * 指定行是否为空
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @param rowIndex
- * 指定开始行,从 0 开始
- * @return true 不为空,false 不行为空
- * @throws IOException
- */
- public boolean isRowNull(int sheetIx, int rowIndex) throws IOException {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- return sheet.getRow(rowIndex) == null;
- }
- /**
- *
- * 创建行,若行存在,则清空
- *
- * @param sheetIx
- * 指定 sheet 页,从 0 开始
- * @param rownum
- * 指定创建行,从 0 开始
- * @return
- * @throws IOException
- */
- public boolean createRow(int sheetIx, int rowIndex) throws IOException {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- sheet.createRow(rowIndex);
- return true;
- }
- /**
- *
- * 指定单元格是否为空
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @param rowIndex
- * 指定开始行,从 0 开始
- * @param colIndex
- * 指定开始列,从 0 开始
- * @return true 行不为空,false 行为空
- * @throws IOException
- */
- public boolean isCellNull(int sheetIx, int rowIndex, int colIndex) throws IOException {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- if (!isRowNull(sheetIx, rowIndex)) {
- return false;
- }
- Row row = sheet.getRow(rowIndex);
- return row.getCell(colIndex) == null;
- }
- /**
- *
- * 创建单元格
- *
- * @param sheetIx
- * 指定 sheet 页,从 0 开始
- * @param rowIndex
- * 指定行,从 0 开始
- * @param colIndex
- * 指定创建列,从 0 开始
- * @return true 列为空,false 行不为空
- * @throws IOException
- */
- public boolean createCell(int sheetIx, int rowIndex, int colIndex) throws IOException {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- Row row = sheet.getRow(rowIndex);
- row.createCell(colIndex);
- return true;
- }
- /**
- * 返回sheet 中的行数
- *
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @return
- */
- public int getRowCount(int sheetIx) {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- if (sheet.getPhysicalNumberOfRows() == 0) {
- return 0;
- }
- return sheet.getLastRowNum() + 1;
- }
- /**
- *
- * 返回所在行的列数
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @param rowIndex
- * 指定行,从0开始
- * @return 返回-1 表示所在行为空
- */
- public int getColumnCount(int sheetIx, int rowIndex) {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- Row row = sheet.getRow(rowIndex);
- return row == null ? -1 : row.getLastCellNum();
- }
- /**
- *
- * 设置row 和 column 位置的单元格值
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @param rowIndex
- * 指定行,从0开始
- * @param colIndex
- * 指定列,从0开始
- * @param value
- * 值
- * @return
- * @throws IOException
- */
- public boolean setValueAt(int sheetIx, int rowIndex, int colIndex, String value) throws IOException {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- sheet.getRow(rowIndex).getCell(colIndex).setCellValue(value);
- return true;
- }
- /**
- *
- * 返回 row 和 column 位置的单元格值
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @param rowIndex
- * 指定行,从0开始
- * @param colIndex
- * 指定列,从0开始
- * @return
- *
- */
- public String getValueAt(int sheetIx, int rowIndex, int colIndex) {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- return getCellValueToString(sheet.getRow(rowIndex).getCell(colIndex));
- }
- /**
- *
- * 重置指定行的值
- *
- * @param rowData
- * 数据
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @param rowIndex
- * 指定行,从0开始
- * @return
- * @throws IOException
- */
- public boolean setRowValue(int sheetIx, List<String> rowData, int rowIndex) throws IOException {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- Row row = sheet.getRow(rowIndex);
- for (int i = 0; i < rowData.size(); i++) {
- row.getCell(i).setCellValue(rowData.get(i));
- }
- return true;
- }
- /**
- *
- * 返回指定行的值的集合
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @param rowIndex
- * 指定行,从0开始
- * @return
- */
- public List<String> getRowValue(int sheetIx, int rowIndex) {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- Row row = sheet.getRow(rowIndex);
- List<String> list = new ArrayList<String>();
- if (row == null) {
- list.add(null);
- } else {
- for (int i = 0; i < row.getLastCellNum(); i++) {
- list.add(getCellValueToString(row.getCell(i)));
- }
- }
- return list;
- }
- /**
- *
- * 返回列的值的集合
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @param rowIndex
- * 指定行,从0开始
- * @param colIndex
- * 指定列,从0开始
- * @return
- */
- public List<String> getColumnValue(int sheetIx, int rowIndex, int colIndex) {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- List<String> list = new ArrayList<String>();
- for (int i = rowIndex; i < getRowCount(sheetIx); i++) {
- Row row = sheet.getRow(i);
- if (row == null) {
- list.add(null);
- continue;
- }
- list.add(getCellValueToString(sheet.getRow(i).getCell(colIndex)));
- }
- return list;
- }
- /**
- *
- * 获取excel 中sheet 总页数
- *
- * @return
- */
- public int getSheetCount() {
- return workbook.getNumberOfSheets();
- }
- public void createSheet() {
- workbook.createSheet();
- }
- /**
- *
- * 设置sheet名称,长度为1-31,不能包含后面任一字符: :\ / ? * [ ]
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始,//
- * @param name
- * @return
- * @throws IOException
- */
- public boolean setSheetName(int sheetIx, String name) throws IOException {
- workbook.setSheetName(sheetIx, name);
- return true;
- }
- /**
- *
- * 获取 sheet名称
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @return
- * @throws IOException
- */
- public String getSheetName(int sheetIx) throws IOException {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- return sheet.getSheetName();
- }
- /**
- * 获取sheet的索引,从0开始
- *
- * @param name
- * sheet 名称
- * @return -1表示该未找到名称对应的sheet
- */
- public int getSheetIndex(String name) {
- return workbook.getSheetIndex(name);
- }
- /**
- *
- * 删除指定sheet
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @return
- * @throws IOException
- */
- public boolean removeSheetAt(int sheetIx) throws IOException {
- workbook.removeSheetAt(sheetIx);
- return true;
- }
- /**
- *
- * 删除指定sheet中行,改变该行之后行的索引
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @param rowIndex
- * 指定行,从0开始
- * @return
- * @throws IOException
- */
- public boolean removeRow(int sheetIx, int rowIndex) throws IOException {
- Sheet sheet = workbook.getSheetAt(sheetIx);
- sheet.shiftRows(rowIndex + 1, getRowCount(sheetIx), -1);
- Row row = sheet.getRow(getRowCount(sheetIx) - 1);
- sheet.removeRow(row);
- return true;
- }
- /**
- *
- * 设置sheet 页的索引
- *
- * @param sheetname
- * Sheet 名称
- * @param pos
- * Sheet 索引,从0开始
- */
- public void setSheetOrder(String sheetname, int sheetIx) {
- workbook.setSheetOrder(sheetname, sheetIx);
- }
- /**
- *
- * 清空指定sheet页(先删除后添加并指定sheetIx)
- *
- * @param sheetIx
- * 指定 Sheet 页,从 0 开始
- * @return
- * @throws IOException
- */
- public boolean clearSheet(int sheetIx) throws IOException {
- String sheetname = getSheetName(sheetIx);
- removeSheetAt(sheetIx);
- workbook.createSheet(sheetname);
- setSheetOrder(sheetname, sheetIx);
- return true;
- }
- public Workbook getWorkbook() {
- return workbook;
- }
- /**
- *
- * 关闭流
- *
- * @throws IOException
- */
- public void close() throws IOException {
- if (os != null) {
- os.close();
- }
- // workbook.close();
- }
- /**
- *
- * 转换单元格的类型为String 默认的 <br>
- * 默认的数据类型:CELL_TYPE_BLANK(3), CELL_TYPE_BOOLEAN(4),
- * CELL_TYPE_ERROR(5),CELL_TYPE_FORMULA(2), CELL_TYPE_NUMERIC(0),
- * CELL_TYPE_STRING(1)
- *
- * @param cell
- * @return
- *
- */
- private String getCellValueToString(Cell cell) {
- String strCell = "";
- if (cell == null) {
- return null;
- }
- switch (cell.getCellType()) {
- case Cell.CELL_TYPE_BOOLEAN:
- strCell = String.valueOf(cell.getBooleanCellValue());
- break;
- case Cell.CELL_TYPE_NUMERIC:
- if (HSSFDateUtil.isCellDateFormatted(cell)) {
- Date date = cell.getDateCellValue();
- if (pattern != null) {
- SimpleDateFormat sdf = new SimpleDateFormat(pattern);
- strCell = sdf.format(date);
- } else {
- strCell = date.toString();
- }
- break;
- }
- // 不是日期格式,则防止当数字过长时以科学计数法显示
- cell.setCellType(HSSFCell.CELL_TYPE_STRING);
- strCell = cell.toString();
- break;
- case Cell.CELL_TYPE_STRING:
- strCell = cell.getStringCellValue();
- break;
- default:
- break;
- }
- return strCell;
- }
- public static boolean isExcel2003(String pathname) {
- return pathname.endsWith(".xls");
- }
- public static void main(String[] args) throws Exception {
- String pathName = "D:/a/e/2.xlsx";
- File f = new File(pathName);
- InputStream in = new FileInputStream(f);
- String version = isExcel2003(pathName)?"2003":"2007";
- ExcelUtil excelUtil = new ExcelUtil(in, version);
- //读取第一个sheet
- List<List<String>> read = excelUtil.read(0);
- for (int i = 0; i < read.size(); i++) {
- List<String> rowList = read.get(i);
- for (String s : rowList) {
- System.out.println(s);
- }
- System.out.println();
- }
- }
- }
java里poi操作Excel工具类【我改】的更多相关文章
- java里poi操作excel的工具类(兼容各版本)
转: java里poi操作excel的工具类(兼容各版本) 下面是文件内具体内容,文件下载: import java.io.FileNotFoundException; import java.io. ...
- 自己封装的poi操作Excel工具类
自己封装的poi操作Excel工具类 在上一篇文章<使用poi读写Excel>中分享了一下poi操作Excel的简单示例,这次要分享一下我封装的一个Excel操作的工具类. 该工具类主要完 ...
- Java 借助poi操作PDF工具类
一直以来说写一个关于Java操作PDF的工具类,也没有时间去写,今天抽空写一个简单的工具类,拥有PDF中 换行,字体大小,字体设置,字体颜色,首行缩进,居中,居左,居右,增加新一页等功能,如果需要 ...
- java操作excel 工具类
java操作excel 可参考https://blog.csdn.net/xunwei0303/article/details/53213130 直接上代码: 一.java生成excel文件: pac ...
- 自己的包poi操作Excel工具
在前面的文章<使用poi读写Excel>中分享了一下poi操作Excel的简单演示样例.这次要分享一下我封装的一个Excel操作的工具类. 该工具类主要完毕的功能是:读取Excel.汇总E ...
- java使用POI操作excel文件,实现批量导出,和导入
一.POI的定义 JAVA中操作Excel的有两种比较主流的工具包: JXL 和 POI .jxl 只能操作Excel 95, 97, 2000也即以.xls为后缀的excel.而poi可以操作Exc ...
- Java使用POI操作Excel文件
1.简介 Apache POI是Apache软件基金会的开放源码函式库,POI提供API给Java程序对Microsoft Office格式文件读和写的功能. 2.依赖的jar包 <!-- ex ...
- java中文件操作的工具类
代码: package com.lky.pojo; import java.io.BufferedReader; import java.io.BufferedWriter; import java. ...
- Java POI操作Excel注意点
excel的行索引和列索引都是从0开始,而行号和列号都是从1开始 POI·操作excel基本上都是使用索引 XSSFRow对象的 row.getLastCellNum() 方法返回的是当前行最后有效列 ...
随机推荐
- 谷歌对Intel 10nm进度不满
Intel 在 10nm 处理器上的节奏可谓是“龟速”,一拖三年,且目前大规模发货的 10nm Ice Lake 处理器仅仅是移动平台低电压,桌面要到明年. 表面波澜不惊,实际上却暗流涌动. 首先是 ...
- 七,ingress及ingress cluster
目录 Service 类型 namespace 名称空间 Ingress Controller Ingress Ingress-nginx 进行测试 创建对应的后端Pod和Service 创建 Ing ...
- 牛客小白月赛12 J 月月查华华的手机 (序列自动机模板题)
链接:https://ac.nowcoder.com/acm/contest/392/J 来源:牛客网 题目描述 月月和华华一起去吃饭了.期间华华有事出去了一会儿,没有带手机.月月出于人类最单纯的好奇 ...
- pikachu-file
1.不安全的文件下载 1.1.概述 文件下载功能在很多web系统上都会出现,一般我们当点击下载链接,便会向后台发送一个下载请求,一般这个请求会包含一个需要下载的文件名称,后台在收到请求后 会开始执行下 ...
- 【HDU6635】Nonsense Time
题目大意:给定一个长度为 N 的序列,开始时所有的位置都不可用,每经过一个时间单位,都会有一个位置被激活.现给定激活顺序的序列,求每次激活之后全局的最长上升子序列的长度,保证数据随机. 题解: 引理: ...
- 【CF160E】Buses and People
题目大意:给定 N 个三元组 (a,b,c),现有 M 个询问,每个询问给定一个三元组 (a',b',c'),求满足 a<a', b'<b, c'<c 的最小 c 对应的元组编号. ...
- 2019年11月18日 JAVA期中考试 增删改查
一.题目 石家庄铁道大学 青年志愿者服务网(20分) 1.项目需求: 为了适应社会主义市场经济发展的需要,推动青年志愿服务体系和多层次社会保障体系的建立和完善,促进青年健康成长,石家庄铁道大学急需 ...
- WSL中使用npm install报错
报错内容类似下面的格式.具体解决方法请看这里:https://github.com/Microsoft/WSL/issues/14 着重关注 https://github.com/Microsoft/ ...
- 通俗易懂的例子解释 IAAS、SAAS、PAAS 的区别
你一定听说过云计算中的三个“高大上”的你一定听说过云计算中的三个“高大上”的概念:IaaS.PaaS和SaaS,这几个术语并不好理解.不过,如果你是个吃货,还喜欢披萨,这个问题就好解决了!好吧,其实你 ...
- Spring CommonsMultipartResolver 上传文件
转:http://yanglei008.iteye.com/blog/246920 ...Controller...{ // 创建一个通用的多部分解析器 CommonsMultipartResolve ...