POI创建excel文件的问题

需要通过POI把合同内容写入到excel表,样式如图:
图片说明
表中有图片,线条,合并单元格,以及各种字体和样式等;
现在想要从数据库中取出信息后,生成excel表, 每一页A4纸上最多显示两种产品信息, 如果合同中的产品种类多余2个, 就需要在下面另外打印一份合同
请大神帮忙给一下思路, 想来好久都不知道该怎么处理这种业务

1个回答

这表格单元格排列有点复杂!

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
java使用POI导入Excel文件时能获得这个Excel的创建时间吗?
![图片说明](https://img-ask.csdn.net/upload/201705/08/1494230896_323025.png) 就是图中的这个修改时间
我用poi将doc或者Excel文件转为html格式在页面显示但是出现了一个问题
java 我用poi将doc或者Excel文件转为html格式在页面显示,首先创建一个html页面用于存放文件转换为html后的代码,比如我首先打开doc的文件,成功显示出来,但是第二次打开Excel的文件,页面却显示的还是doc的文件,再打开idea看代码,那html文件明明是Excel的。(我怀疑是页面缓存,但不知道该如何设置,html页面都是自动生成的无法修改头)
POI 生成Excel 分段处理问题
<p>大家好! <br><br>我在做java 生成Excel文件时,由于数据量很大(七万多条),我创建的文件扩展名是xlsx,一下不可以导入Excel中,下载做分段导入,就是在sql语句中(例如每次查询2000条),当第一次执行时,先创建Excel标题,然后把第一次查询的2000数据写入Excel中,然后一直循环,直到把全部数据写入。请问大侠们,怎么循环写入?用什么方法? <br><br>if(i == 0 ) <br>{ <br>     FileOutputStream os = new FileOutputStream(new File(“D:\\excel\a.xlsx”)); <br>     XSSFWorkbook wb = new XSSFWorkbook(); <br>// <br>     XSSFSheet sheet = (XSSFSheet) wb.createSheet("aaa"); <br>// <br>     XSSFRow row = null; <br>     XSSFCell cell = null; <br>     int row_num = 0; <br>     int cell_num = 0; <br><br>     row = sheet.createRow(row_num); <br>     row.setHeightInPoints(30); <br>     sheet.autoSizeColumn(0, true); <br><br>     cell = row.createCell(cell_num++); <br>     ExcelUtil.setFormatTitleCenter(wb, cell); <br>     cell.setCellValue("SEQ"); <br>     <br>     wb.write(os); <br>     os.close(); <br>} <br>if(list.size()&gt;0){ <br>File file = new File(StringUtil.FILE_NAME); <br><br>String fullname = file.getAbsolutePath(); <br><br>FileInputStream fs = new   FileInputStream(fullname); <br><br>XSSFWorkbook wb = new XSSFWorkbook(fs); <br><br>XSSFSheet   sheet   =   wb.getSheetAt(0); <br><br><br>PDTO dto = null; <br>Iterator itor = list.iterator(); <br>   <br>XSSFRow row = null; <br>XSSFCell cell = null; <br><br>                   while( itor.hasNext() ) <br>{ <br>dto = (PipeDTO)itor.next(); <br>i++; <br>//定义列 <br>int j=0; <br>row = sheet.createRow(i); <br>//设置行长度自动 <br>//row.setHeight((short)500); <br>row.setHeightInPoints(20); <br>//row.setZeroHeight(true); <br>sheet.autoSizeColumn(j+1, true); <br>//获得这一行的每j列 <br>cell = row.createCell(j++); <br>//给单元格设值 <br>ExcelUtil.setFormatLineRight(wb, cell); <br>cell.setCellValue(dto.getSeq); <br>} <br>FileOutputStream os = new FileOutputStream(new File(“D:\\excel\a.xlsx”)); <br>wb.write(os); <br>os.close(); <br>               } <br>               else <br>      { <br>break; <br>      } <br>这样执行是还是这样的错误, <br>[java] java.lang.ArrayIndexOutOfBoundsException: -32765 <br>[java]     at java.util.ArrayList.get(Unknown Source) <br>[java]     at org.apache.poi.xssf.model.StylesTable.getFontAt(StylesTable.java:190) <br>[java]     at org.apache.poi.xssf.usermodel.XSSFWorkbook.getFontAt(XSSFWorkbook.java:592) <br>[java]     at org.apache.poi.xssf.usermodel.helpers.ColumnHelper.getColumnWidth(ColumnHelper.java:355) <br>[java]     at org.apache.poi.xssf.usermodel.XSSFSheet.autoSizeColumn(XSSFSheet.java:337) <br>[java]     at dlstx.monitor.data.pipe.PipeDAO.rt_code_check_error(PipeDAO.java:688) <br>[java]     at dlstx.monitor.data.ERPMonitor.pipeCheck(ERPMonitor.java:105) <br>[java]     at dlstx.monitor.data.ERPMonitor.main(ERPMonitor.java:53) <br>请指点,有没有好点的方法,怎么修改,十分感谢!</p> <p> </p>
java使用poi开源框架生成excel文件并对其进行加密登入用户名若为汉字则出现乱码
public static byte[] encryptExcel(byte[] bytes, String password, String userName) { byte[] enExcelBytes = null; try { // 创建一个工作薄 HSSFWorkbook workbook = new HSSFWorkbook(new ByteArrayInputStream(bytes)); // 设置密码 workbook.writeProtectWorkbook(password, userName); // 获得Excel文件字节数组 enExcelBytes = getExcelBytes(workbook); } catch (IOException e) { LogUtil.log(e); } return enExcelBytes; } 这是加密用的接口,userName为用户名。 打开生成加密的excel文件时用户名乱码: ![CSDN移动问答][1] ![CSDN移动问答][2] [1]: http://C:%5CUsers%5CAdministrator.DADI%5CDesktop%5CQQ%E6%88%AA%E5%9B%BE20130924165340.png
java poi修改Excel单元格格式无效
// 创建对Excel工作簿文件的引用 HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(path)); HSSFCellStyle cellStyle =workbook.createCellStyle(); cellStyle.setFillBackgroundColor(HSSFColor.RED.index); cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); ..................................... cell.setCellStyle(cellStyle); //读取excle文件, 校验单元格数据,如果格式不对。就需要修改单元格样式。
poi3.11 linux 下解析了不excel2007 但win7下没问题
使用spring mvc 上传文件。POI 在linux 64位下解析不了excel2007文件。而win7 32位下没问题。使用wps创建的excel都没问题。经过调试发现window下,上传文件的时候文件头是847d1caa,当写入本地再读取后会将文件头改为504b0304(zip格式),所以可以正常运行。但linux下再读取文件头也不会变,导致POI识别不了。代码如下: @RequestMapping(value = "uploadPriceXlsFile", method = RequestMethod.POST) public @ResponseBody String upload(HttpServletRequest req, HttpServletResponse resp ) throws Exception { boolean isMultipart = ServletFileUpload.isMultipartContent(req); HashMap<String, String> request = new HashMap<String, String>(); if (isMultipart) { DiskFileItemFactory factory = new DiskFileItemFactory(1024 * 1024 * 20, null); ServletFileUpload upload = new ServletFileUpload(factory); upload.setHeaderEncoding("UTF-8"); upload.setSizeMax(1024 * 1024 * 20); List<FileItem> fileItems = upload.parseRequest(req); Iterator<FileItem> iter = fileItems.iterator(); while (iter.hasNext()) { FileItem item = (FileItem) iter.next(); if (item.isFormField()) { String name = item.getFieldName(); String value = item.getString("UTF-8"); request.put(name,value); } else { String filename = item.getName(); byte b[]=item.get(); for(int i=0;i<5;i++){ logger.debug(b[i]+"------------------------------"); } //文件头显示为847d1caa byte[-124,125,28,-86,123] logger.debug(Test.bytesToHexString(b)); String realPath = req.getSession().getServletContext().getRealPath("/WEB-INF/upload"); //File uploadFile = new File(realPath+"/"+filename); FileUtils.copyInputStreamToFile(item.getInputStream(), new File(realPath,filename)); File uploadFile = new File(realPath+"/"+filename); InputStream in=new FileInputStream(uploadFile); in.read(b); logger.debug(b[0]+"---"+b[1]+"---"+b[2]); //window服务器则会变成504b0304 byte[80.75.3] <span></span> logger.debug(Test.bytesToHexString(b)); logger.debug("编码格式"+" "+System.getProperty("file.encoding")); return memberService.uploadPriceXLS(in,filename); } } } 文件头847d1caa(对应byte[-124,125,28,-86,123..])是啥文件? 为啥win7读出来文件头就变504b0304(zip格式 对应byte[80.75.3....]) ,而linux则不会改变报以下错误(版本不支持) exception:org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13] 请各位大侠帮帮忙,谢谢
如何将excel文件动态导入到ORACLE数据库中
用一个jsp页面上传excel文件,然后读取excel文件中的内容,并创建在oracle中创建一个对应的表。oracle中本身是没有表的,并且也不知道要上传的excel包含哪些内容,创建表和表字段都是动态的。我知道解析excel可以用poi,上传可以用fileupload,但这是我从网上查资料知道的,我没有实际做过什么项目,所以就算知道要用什么方法,逻辑也整理不出来,所以请懂这方面的大神帮帮忙,求源码。谢谢
请教一个关于POI的问题
代码如下: import java.io.FileOutputStream; import java.io.IOException; //import org.apache.poi.hssf.*; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.usermodel.*; public class ex1 { public static void main(String[] args) throws IOException { // 创建一个excel文件 Workbook wb = new HSSFWorkbook(); FileOutputStream fileOut = new FileOutputStream("C://workbook.xlsx"); wb.write(fileOut); fileOut.close(); } } 运行环境是Myeclipse,始终报错: Exception in thread "main" java.lang.Error: Unresolved compilation problems: HSSFWorkbook cannot be resolved to a type HSSFWorkbook cannot be resolved to a type at ex1.main(ex1.java:10) 是我的外部jar包添加有问题吗,还忘前辈们指导,谢谢。
java POI3.8 Excel 下载 发现不可读取内容 解决办法??
![图片说明](https://img-ask.csdn.net/upload/201701/17/1484635471_937430.png) ![图片说明](https://img-ask.csdn.net/upload/201701/17/1484635688_899413.png) ``` /** * 导出历史记录 */ @SuppressWarnings({ "deprecation", "unchecked" }) @RequestMapping("export-TrainHistoryRecord") @ResponseBody protected void buildExcelDocument(EmployeeTrainHistoryQuery query,ModelMap model, SXSSFWorkbook workbook, HttpServletRequest request, HttpServletResponse response) throws Exception { //这里使用SXSSFWorkbook对象,支持1048576条数据 try { response.reset(); // 获得国际化语言 RequestContext requestContext = new RequestContext(request); String CourseCompany = requestContext .getMessage("manage-student-trainRecods"); response.setContentType("APPLICATION/vnd.ms-excel;charset=UTF-8"); // 注意,如果去掉下面一行代码中的attachment; 那么也会使IE自动打开文件。 response.setHeader( "Content-Disposition", "attachment; filename=" + java.net.URLEncoder.encode( DateUtil.getExportDate() + ".xlsx", "UTF-8"));//Excel 扩展名指定为xlsx SXSSFWorkbook对象只支持xlsx格式 OutputStream os = response.getOutputStream();// new CellStyle style = workbook.createCellStyle(); // 设置样式 style.setFillForegroundColor(HSSFColor.SKY_BLUE.index); style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); style.setBorderBottom(HSSFCellStyle.BORDER_THIN); style.setBorderLeft(HSSFCellStyle.BORDER_THIN); style.setBorderRight(HSSFCellStyle.BORDER_THIN); style.setBorderTop(HSSFCellStyle.BORDER_THIN); style.setAlignment(HSSFCellStyle.ALIGN_CENTER); String employeeCode = requestContext.getMessage("employeeCode"); String employeeName = requestContext.getMessage("employeeName"); String orgName = requestContext.getMessage("orgName"); String startDate = requestContext.getMessage("start.date"); String endDate = requestContext.getMessage("end.date"); String courseCode = requestContext.getMessage("courseCode"); String courseName = requestContext.getMessage("courseName"); String sessionName = requestContext.getMessage("sessionName"); String hoursNunber = requestContext.getMessage("hoursNunber"); // FileOutputStream(filePath); List<EmployeeTrainHistoryModel> list = null; query.setNeedQueryAll(true); try { // if("0".equals(query.getTrainFlag())){ query.setTotalItem(employeeTrainHistoryService.fetchCountEmployeeTrainHistoryByQuery(query)); int page_size = 100000;// 数据库中存储的数据行数 int list_count =query.getTotalItem(); int export_times = list_count % page_size > 0 ? list_count / page_size + 1 : list_count / page_size; for (int m = 0; m < export_times; m++) { query.setNeedQueryAll(false); query.setPageSize(100000);//每页显示多少条数据 query.setCurrentPage(m+1);//设置第几页 list=employeeTrainHistoryService.getEmployeeTrainHistoryByQuery(query); int len = list.size() < page_size ? list.size() : page_size; //新建sheet Sheet sheet = null; sheet = workbook.createSheet(System.currentTimeMillis() + CourseCompany+m); // for (int n = 0; n < len; n++) { // 迭代数据 if (list != null && list.size() > 0) { int rowNum = 1; int max_row=300000; int sheet_count=0; for (int i = 0; i < list.size(); i++) { EmployeeTrainHistoryModel history=list.get(i); //如果当前行超过单页签可容纳最大行则换页签 // if(i==0||i==(max_row*sheet_count+1)){ sheet.setDefaultColumnWidth((short) 17); // 创建属于上面Sheet的Row,参数0可以是0~65535之间的任何一个, Row header = sheet.createRow(0); // 第0行 // 产生标题列 Cell cell; String[] headerArr = new String[] { employeeCode, employeeName, orgName, startDate, endDate, courseCode, courseName, sessionName, hoursNunber }; for (int j = 0; j < headerArr.length; j++) { cell = header.createCell((short) j); cell.setCellStyle(style); cell.setCellValue(headerArr[j]); } Row row = sheet.createRow(rowNum++); row.createCell((short) 0).setCellValue( history.getEmployeeCode()); row.createCell((short) 1).setCellValue( history.getEmployeeName()); row.createCell((short) 2) .setCellValue(history.getOrgName()); if (history.getTrainBeginTime() != null) { row.createCell((short) 3).setCellValue( DateUtil.toString(history.getTrainBeginTime())); } else { row.createCell((short) 3).setCellValue(""); } if (history.getTrainEndTime() != null) { row.createCell((short) 4).setCellValue( DateUtil.toString(history.getTrainEndTime())); } else { row.createCell((short) 4).setCellValue(""); } row.createCell((short) 5).setCellValue( history.getCourseCode()); row.createCell((short) 6).setCellValue( history.getCourseName()); row.createCell((short) 7).setCellValue( history.getSessionName()); if (history.getHoursNumber() != null) row.createCell((short) 8).setCellValue( history.getHoursNumber().toString()); } } list.clear(); } } catch (Exception e) { e.printStackTrace(); } try { workbook.write(os); model.put("msg", "1"); os.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); } } ```
怎么使用java Poi解决导入excel表格大数据量时的内存溢出问???大神们,帮帮我。
public String admin_product_list() { // System.out.println("myFileFileName "+myFileFileName); String path = ""; String name = ""; String realpath = ""; String afterfilename = ""; drlogbean = new Daorulog(); int daorutiaoshu = 0; String oldfilename = ""; int rowaccess=2; try { if (myFileFileName != null && !myFileFileName.equals("")) { oldfilename = myFileFileName; String b[] = oldfilename.split("\\."); // 设置上传文件目录 String filePath = ServletActionContext.getServletContext().getRealPath("/upload"); // 基于myFile创建文件输入流 InputStream is = new FileInputStream(myFile); String a[] = myFileFileName.split("\\."); // System.out.println("上传文件名:"+a[0]+"上传文件类型:"+a[1]); // 设置目标文件 DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); Date date = new Date(); String strdf = df.format(date).toString(); name = "upload/" + b[0] + "_" + strdf + "." + a[1]; File toFile = new File(filePath, b[0] + "_" + df.format(date).toString() + "." + a[1]); path = filePath + "\\" + name; // System.out.println(path); // 创建一个输出流 OutputStream os = new FileOutputStream(toFile); // OutputStream bos = new // FileOutputStream(filePath);//建立一个上传文件的输出流 int bytesRead = 0; byte[] buffer = new byte[8192]; while ((bytesRead = is.read(buffer, 0, 8192)) != -1) { os.write(buffer, 0, bytesRead);// 将文件写入服务器 } realpath = filePath + "\\" + b[0] + "_" + strdf + "." + a[1]; afterfilename = b[0] + "_" + strdf + "." + a[1]; System.out.println("realpath " + realpath); System.out.println("sourseTypeName " + sourseTypeName); InputStream is2 = new FileInputStream(realpath); fileRealName = realpath; SXSSWorkbook workbook =new SXSSFWorkbook(rowaccess); Sheet sheet = workbook.getSheetAt(0); Row row = sheet.getRow(headerRow); int lastCellNum = row.getLastCellNum(); for (int i = 0; i < lastCellNum; i++) { if (row.getCell(i) == null || row.getCell(i).toString() == null) continue; cellMap.put(i, row.getCell(i).toString()); } //每当行数达到设置的值就刷新数据到硬盘,以清理内存 if(i/rowaccess==0){ System.out.println("清除缓存重新输入"); //sheet.flushRows(); ((SXSSFSheet)sh).flushRows(); } dwzdlist = productDAO.findAlldanweizidianList(); } } catch (Exception e) { e.printStackTrace(); } malist = productDAO.findAlldanweiList(); return "importStep2"; } /** * 单位码表类型 * * @return */ public String admin_find_danweizidian() { return "danweizidian"; } // =============================2016-05-12 end public String importPreview() { int introwaccess=2;//内存中缓存记录行数 //System.out.println(kuozhan1); try { InputStream is2 = new FileInputStream(fileRealName); SXSSFWorkbook workbook = new SXSSFWorkbook(introwaccess); Sheet sheet = workbook.getSheetAt(0); int lastRowNum = sheet.getLastRowNum(); List<ResourceImport> riList = new ArrayList<ResourceImport>(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); for (int i = firstDataRow; i < lastRowNum+1; i++) { Row row = sheet.getRow(i); ResourceImport ri = new ResourceImport(); // 非标准的详细地址 String nsAddress = ""; if (row.getCell(xiangxiaddress) != null) { nsAddress = row.getCell(xiangxiaddress).toString(); ri.setYehuxiangxiaddress(nsAddress); } String nsAddressClone = nsAddress; ri.setLeibie(leibie.split(",")[0]); if (row.getCell(name) != null) { String nameR = row.getCell(name).toString(); if (nameR.contains("\n")) { String[] nameRA = nameR.split("\n"); StringBuffer sb = new StringBuffer(); for (int k = 0; k < nameRA.length; k++) { if (k != nameRA.length - 1) { sb.append(nameRA[k]); sb.append(","); } else { sb.append(nameRA[k]); } } ri.setYehuname(sb.toString()); } else { ri.setYehuname(nameR); } } if (row.getCell(tel) != null) { Cell cell = row.getCell(tel); if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {//poi导入,转换成String类型 DecimalFormat df = new DecimalFormat("0");//格式化实例化数字 ri.setYehumobilephone(df.format(cell.getNumericCellValue())); } else { ri.setYehumobilephone(cell.toString()); } } if (row.getCell(sex) != null) ri.setYehusex(row.getCell(sex).toString()); if (row.getCell(age) != null) ri.setYehuage(row.getCell(age).toString()); if (row.getCell(dateofbirth) != null) ri.setYehudateofbirth(row.getCell(dateofbirth).toString()); ri.setYehuzhenjiantype(zhenjiantype); if (row.getCell(zhengjiancode) != null) ri.setYehuzhengjiancode(row.getCell(zhengjiancode).toString()); if (row.getCell(yehujinjilinkman) != null) ri.setYehujinjilinkman(row.getCell(yehujinjilinkman).toString()); if (row.getCell(yehujinjilinkmanphone) != null) { Cell cell = row.getCell(yehujinjilinkmanphone); if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {//poi导入,转换成String类型 DecimalFormat df = new DecimalFormat("0");//格式化实例化数字 ri.setYehujinjilinkmanphone(df.format(cell.getNumericCellValue())); } else { ri.setYehujinjilinkmanphone(cell.toString()); } }
关于excel文件导入到mysql数据没有读取到文件问题
<p>  我最近在做一个oa项目,其中有一个excel文件导入到数据中去,用poi做的。我现在在后台能够得到文件的完整路径,但是HSSFWorkbook并没有创建一个工作簿。在网上找了很多资料,并没有找到解决方案,本人是只菜鸟,望各位大侠指路,帮忙看看。谢谢!</p> <p>前台import.jsp代码:</p> <div class="quote_title">写道</div> <div class="quote_div">&lt;%@ page contentType="text/html;charset=GBK"%&gt; <br>&lt;%@ page session="true" %&gt; <br>&lt;%@ page isThreadSafe="true" %&gt; <br>&lt;head&gt; <br><br>&lt;style type="text/css"&gt; <br>&lt;!-- <br>body,td,th { <br>font-size: 12px; <br>} <br>--&gt; <br>&lt;/style&gt; <br>&lt;title&gt;&lt;/title&gt; <br>&lt;/head&gt; <br>&lt;body &gt; <br><br>&lt;script language="javascript"&gt; <br>function add(){ <br>var filePath = document.myform.Urlexcel.value; <br>alert(filePath); <br>myform.action="saveExcel.jsp?filePath="+filePath ; <br>myform.submit(); <br>} <br><br>&lt;/script&gt; <br>&lt;form action="saveExcel.jsp" enctype="multipart/form-data" name="myform" method="post" onSubmit="return check(this)"&gt; <br><br>&lt;p&gt; &lt;/p&gt; <br>&lt;p&gt; &lt;/p&gt; <br>&lt;p&gt; &lt;/p&gt; <br>&lt;table width="80%" border="0" align="center" cellpadding="0" cellspacing="0"&gt; <br>&lt;tr&gt; <br>&lt;td height="50" align="center" valign="middle"&gt; &lt;/td&gt; <br>&lt;td height="50" align="left" valign="middle"&gt; Excel文件: <br>&lt;input name="Urlexcel" type="file" id="Urlexcel" size="41" /&gt;&lt;/td&gt; <br>&lt;td&gt; &lt;/td&gt; <br>&lt;/tr&gt; <br>&lt;tr&gt; <br><br>&lt;td height="50" align="center" valign="middle" colspan="2"&gt; <br>&lt;input type="button" onClick="add();" name="Submit1" value="确认提交" /&gt; <br>         <br>&lt;input type="submit" name="Submit2" value="取消重置" /&gt; <br>&lt;/td&gt; <br>&lt;td&gt; &lt;/td&gt; <br>&lt;/tr&gt; <br>&lt;/table&gt; <br>&lt;/form&gt; <br><br>&lt;/body&gt; <br>&lt;/html&gt;</div> <p> </p> <p>后台saveExcel.jsp代码:</p> <pre name="code" class="java">&lt;%@ page language="java"%&gt; &lt;%@ page session="true"%&gt; &lt;%@ page isThreadSafe="true"%&gt; &lt;%@ page contentType="text/html;charset=GBK"%&gt; &lt;%@page import="org.apache.poi.hssf.usermodel.HSSFWorkbook"%&gt; &lt;%@page import="java.io.FileInputStream"%&gt; &lt;%@page import="org.apache.poi.hssf.usermodel.HSSFSheet"%&gt; &lt;%@page import="org.apache.poi.hssf.usermodel.HSSFCell"%&gt; &lt;%@page import="org.apache.poi.hssf.usermodel.HSSFRow"%&gt; &lt;%@page import="java.io.FileNotFoundException"%&gt; &lt;%@page import="java.io.IOException"%&gt; &lt;%@page import="org.apache.poi.poifs.filesystem.POIFSFileSystem"%&gt; &lt;% String filePath = request.getParameter("filePath"); out.println(filePath); try { // 创建对Excel工作簿文件的引用 FileInputStream fis = new FileInputStream(filePath); POIFSFileSystem fs = new POIFSFileSystem(fis); HSSFWorkbook wookbook = new HSSFWorkbook(fs); out.println(wookbook);//此处并没有打印出能容 HSSFSheet sheet = wookbook.getSheet("Sheet1"); // 获取到Excel文件中的所有行数 int rows = sheet.getPhysicalNumberOfRows(); out.println(rows); // 遍历行 for (int i = 0; i &lt; rows; i++) { // 读取左上端单元格? HSSFRow row = sheet.getRow(i); // 行不为空 if (row != null) { // 获取到Excel文件中的所有的列 int cells = row.getPhysicalNumberOfCells(); String value = ""; // 遍历列 for (short j = 0; j &lt; cells; j++) { // 获取到列的值 HSSFCell cell = row.getCell(j); if (cell != null) { switch (cell.getCellType()) { case HSSFCell.CELL_TYPE_FORMULA: break; case HSSFCell.CELL_TYPE_NUMERIC: value += cell.getNumericCellValue() + ","; break; case HSSFCell.CELL_TYPE_STRING: value += cell.getStringCellValue() + ","; break; default: value += "0"; break; } } } // 将数据插入到mysql数据库中 String[] val = value.split(","); Nsxxb1 entity = new Nsxxb1() ; entity.setGLM(val[0]); entity.setQYMC(val[1]); entity.setXSE1(Double.parseDouble(val[2])); entity.setZZS1(Double.parseDouble(val[3])); entity.setYYS1(Double.parseDouble(val[4])); entity.setXFS1(Double.parseDouble(val[5])); entity.setQYSDS1(Double.parseDouble(val[6])); entity.setGRSDS1(Double.parseDouble(val[7])); entity.setYHS1(Double.parseDouble(val[8])); entity.setTDZZS1(Double.parseDouble(val[9])); entity.setCJS1(Double.parseDouble(val[10])); Nsxxb1Service.insert(entity); } } catch (FileNotFoundException e) { out.println("导入失败"); e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } %&gt; </pre> <p> </p>
java+poi实现下面的格式
![图片说明](https://img-ask.csdn.net/upload/201601/25/1453692519_563496.png) 请问怎么实现框框圈起来的部分?? 我的代码如下: public class ExportToExcelServiceImpl implements ExportToExcelService { @Autowired private ExportToExcelDao exportToExcelDao; public void setExportToExcelDao(ExportToExcelDao exportToExcelDao) { this.exportToExcelDao = exportToExcelDao; } /** * 导出合作渠道 * * @param HttpServletRequest * request, HttpServletResponse response, String startData, * String endtData * @return * */ @Override public void exportChannelToExcel(HttpServletRequest request, HttpServletResponse response, String startData, String endtData) { /** * 取出渠道数据 * */ List<CooperationChannel> channelList = exportToExcelDao .exportChannelToExcel(startData, endtData); // List<CooperationChannel> channelList = exportToExcelDao // .exportChannelToExcel(); /** * 创建渠道统计的excel * */ // 下载生成的合作渠道报表到自定义的位置 try { request.setCharacterEncoding("UTF-8"); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } response.setCharacterEncoding("UTF-8"); response.setContentType("application/octet-stream"); // 设置生成的文件类型 String filedisplay = "合作渠道报表.xls"; try { filedisplay = URLEncoder.encode(filedisplay, "UTF-8"); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } response.addHeader("Content-Disposition", "attachment;filename=" + filedisplay); // 设置文件头编码方式和文件名 // 创建一个workbook 对应一个excel应用文件 HSSFWorkbook workBook = new HSSFWorkbook(); // 在workbook中添加一个sheet,对应Excel文件中的sheet CellRangeAddress cra = new CellRangeAddress(0, 0, 0, 15); CellRangeAddress cra1 = new CellRangeAddress(1, 1, 0, 4); CellRangeAddress cra2 = new CellRangeAddress(1, 1, 5, 9); // CellRangeAddress cra3 = new CellRangeAddress(1, 1, 10, 15); HSSFSheet sheet = workBook.createSheet("合作渠道"); // 在sheet里增加合并单元格 sheet.addMergedRegion(cra); sheet.addMergedRegion(cra1); sheet.addMergedRegion(cra2); // sheet.addMergedRegion(cra3); // 获取表格样式 ExportUtil exportUtil = new ExportUtil(workBook, sheet); HSSFCellStyle titleStyle = exportUtil.getTitleStyle(); HSSFCellStyle titleStyle1 = exportUtil.getTitleStyle1(); HSSFCellStyle headStyle = exportUtil.getHeadStyle(); HSSFCellStyle bodyStyle = exportUtil.getBodyStyle(); // 构建表标题1 HSSFRow head = sheet.createRow(0); HSSFCell cell = null; String headTitle = "合作渠道数据统计表"; cell = head.createCell(0); cell.setCellStyle(titleStyle); cell.setCellValue(headTitle); // 构建表标题2 HSSFRow head1 = sheet.createRow(1); HSSFCell cell1 = null; String headTitle1= "部门:市场品牌部"; cell1 = head1.createCell(5); cell1.setCellStyle(titleStyle1); cell1.setCellValue(headTitle1); // 构建表标题2 // HSSFRow head2 = sheet.createRow(1); HSSFCell cell2 = null; String headTitle2= "日期:"; cell2 = head1.createCell(5); cell2.setCellStyle(titleStyle1); cell2.setCellValue(headTitle2); // // 构建表标题2 // HSSFRow head3 = sheet.createRow(1); // HSSFCell cell3 = null; // String headTitle3= "单位:元"; // cell3 = head3.createCell(4); // cell3.setCellStyle(headStyle); // cell3.setCellValue(headTitle3); // String[] headTitle1 = new String[] { "部门:市场品牌部", "日期:", "单位:元" }; // for (int i = 0; i < headTitle1.length; i++) { // cell = head1.createCell(i); // cell.setCellStyle(titleStyle1); // cell.setCellValue(headTitle1[i]); // } // 构建表头 HSSFRow headRow = sheet.createRow(2); String[] titles = new String[] { "序号", "渠道名称", "点击量", "下载量", "激活数", "注册数", "注册率", "实名数", "实名率", "登录数", "绑卡数", "绑卡率", "投资数", "投资率", "充值总额", "投资总额" }; for (int i = 0; i < titles.length; i++) { cell = headRow.createCell(i); cell.setCellStyle(headStyle); cell.setCellValue(titles[i]); } // 构建表体数据 if (channelList != null && channelList.size() > 0) { for (int j = 2; j < channelList.size(); j++) { HSSFRow bodyRow = sheet.createRow(j + 1); CooperationChannel cooperationChannel = channelList.get(j); // getChannel_id,并把数据写入excel中的单元格,下同。 cell = bodyRow.createCell(0); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getChannel_id()); // getChannel_name cell = bodyRow.createCell(1); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getChannel_name()); // getClick_amount cell = bodyRow.createCell(2); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getClick_amount()); // getDownload_amount cell = bodyRow.createCell(3); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getDownload_amount()); // getActivation_amount cell = bodyRow.createCell(4); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getActivation_amount()); // getRegister_amount cell = bodyRow.createCell(5); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getRegister_amount()); // getRegister_rate cell = bodyRow.createCell(6); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getRegister_rate()); // getAutonym_amount cell = bodyRow.createCell(7); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getAutonym_amount()); // getAutonym_rate cell = bodyRow.createCell(8); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getAutonym_rate()); // getLogin_amount cell = bodyRow.createCell(9); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getLogin_amount()); // getBound_card_amount cell = bodyRow.createCell(10); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getBound_card_amount()); // getBound_card_rate cell = bodyRow.createCell(11); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getBound_card_rate()); // getInvestment_amount cell = bodyRow.createCell(12); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getInvestment_amount()); // getInvestment_rate cell = bodyRow.createCell(13); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getInvestment_rate()); // getRecharge_total_amount cell = bodyRow.createCell(14); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel.getRecharge_total_amount()); // getInvestment_total_amount cell = bodyRow.createCell(15); cell.setCellStyle(bodyStyle); cell.setCellValue(cooperationChannel .getInvestment_total_amount()); } } try { // FileOutputStream fos = new FileOutputStream( // "C:\\Users\\lida\\Desktop\\testData\\fr0_markbran_001.xls"); OutputStream ops = response.getOutputStream(); workBook.write(ops); ops.flush(); ops.close(); } catch (IOException e) { e.printStackTrace(); // } finally { // try { // // fos.close(); // } catch (IOException e) { // e.printStackTrace(); // } } }
如何用xssf方法在java中设置excel的cell的格式为文本格式
``` package com.sitech.dss.ssjf.service.impl; import java.io.OutputStream; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.apache.commons.collections.MapUtils; import org.apache.log4j.Logger; import org.apache.poi.hssf.usermodel.HSSFDataFormat; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Font; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.struts2.ServletActionContext; import org.springframework.stereotype.Service; import com.sitech.dss.ssjf.service.ExportUniteService; /** * 统一导出功能实现类 * @author cfl * 2014-7-31 */ @Service("export_service") public class ExportUniteServiceImpl implements ExportUniteService { private Logger logger = Logger.getLogger(ExportUniteServiceImpl.class); /** * EXCEL单行表头导出功能实现 * @author cfl */ @Override public void exportExcelBySingleHeader(List<Map<String, Object>> dateList, Map<String,String> headMap,String filename, String sheetName,Map<String, Object> styleMap) { try { /**---------------------------------------输出控制---------------------------------------------------------**/ HttpServletResponse response = ServletActionContext.getResponse(); OutputStream os = response.getOutputStream();// 取得输出流 filename = filename+".xlsx"; filename = new String(filename.getBytes("GBK"), "iso8859-1"); response.reset();// 清空输出流 response.setHeader("Content-disposition", "attachment; filename="+filename);// 设定输出文件头 response.setContentType("application/msexcel");// 定义输出类型 /**---------------------------------------创建webbook---------------------------------------------------------**/ // 第一步,创建一个webbook,对应一个Excel文件 XSSFWorkbook wb = new XSSFWorkbook(); // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet XSSFSheet sheet = wb.createSheet(sheetName); // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short XSSFRow row = sheet.createRow((int) 0); sheet.setDefaultColumnWidth((short) 15); /**---------------------------------------表头样式设置---------------------------------------------------------**/ // 第四步,创建单元格,并设置值表头 设置表头居中 CellStyle style = wb.createCellStyle(); style.setAlignment(XSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式 //设置背景颜色 setBackColor(style,MapUtils.getShortValue(styleMap, "headerBackColor")); //设置边框颜色 setBorder(style,CellStyle.BORDER_THIN,MapUtils.getShortValue(styleMap, "borderColor")); //设置字体 Font font=wb.createFont(); setFont(font,style,(short)MapUtils.getIntValue(styleMap, "headerFontSize"),MapUtils.getShortValue(styleMap, "headerFontColor") , MapUtils.getString(styleMap, "font")); /**----------------------------------------表内容样式设置--------------------------------------------------------**/ CellStyle style2 = wb.createCellStyle(); //设置边框颜色 setBorder(style2,CellStyle.BORDER_THIN,MapUtils.getShortValue(styleMap, "borderColor")); //设置字体 Font font2=wb.createFont(); setFont(font2,style2,(short)MapUtils.getIntValue(styleMap, "bodyFontSize"),MapUtils.getShortValue(styleMap, "bodyFontColor") , MapUtils.getString(styleMap, "font")); style2.setAlignment(XSSFCellStyle.ALIGN_CENTER); /**----------------------------------------表头信息组装--------------------------------------------------------**/ XSSFCell cell = row.createCell((short) 0); int cellIndex = 0; for(Map.Entry<String, String> entry:headMap.entrySet()){ cell = row.createCell((short) cellIndex); cell.setCellValue(entry.getValue()); cell.setCellStyle(style); cellIndex++; } /**-----------------------------------------表内容信息组装-------------------------------------------------------**/ for (int i = 0; i < dateList.size(); i++) { row = sheet.createRow((int) i + 1); Map map = dateList.get(i); int rowCellIndex = 0; for(Map.Entry<String, String> entry:headMap.entrySet()){ cell = row.createCell((short) rowCellIndex); cell.setCellValue(MapUtils.getString(map, entry.getKey())); cell.setCellStyle(style2); rowCellIndex++; } } /**-----------------------------------------写入输出流,关闭输出流-------------------------------------------------------**/ wb.write(os); os.flush(); os.close(); } catch (Exception e) { e.printStackTrace(); } } /** * 设置背景颜色 * @author cfl * @param style style对象 * @param color :IndexedColors.SKY_BLUE.getIndex() * @return */ public static CellStyle setBackColor(CellStyle style,short color){ //设置前端颜色 style.setFillForegroundColor(color); //设置填充模式 style.setFillPattern(CellStyle.SOLID_FOREGROUND); return style; } /** * 设置单元格边框(四个方向的颜色一样) * @author cfl * @param style style对象 * @param borderStyle 边框类型 :dished-虚线 thick-加粗 double-双重 dotted-有点的 CellStyle.BORDER_THICK * @param borderColor 颜色 IndexedColors.BLUE.getIndex() * @return */ public static CellStyle setBorder(CellStyle style,short borderStyle,short borderColor){ //设置底部格式(样式+颜色) style.setBorderBottom(borderStyle); style.setBottomBorderColor(borderColor); //设置左边格式 style.setBorderLeft(borderStyle); style.setLeftBorderColor(borderColor); //设置右边格式 style.setBorderRight(borderStyle); style.setRightBorderColor(borderColor); //设置顶部格式 style.setBorderTop(borderStyle); style.setTopBorderColor(borderColor); return style; } /** * * 设置字体(简单的需求实现,如果复杂的字体,需要自己去实现)尽量重用 * @author cfl * @param style style对象 * @param fontSize 字体大小 shot(24) * @param color 字体颜色 IndexedColors.BLACK.getIndex() * @param fontName 字体名称 "Courier New" * @param */ public static CellStyle setFont(Font font, CellStyle style,short fontSize,short color,String fontName){ font.setFontHeightInPoints(fontSize); font.setFontName(fontName); //font.setItalic(true);// 斜体 //font.setStrikeout(true);//加干扰线 font.setColor(color);//设置颜色 // Fonts are set into a style so create a new one to use. style.setFont(font); return style; } } ``` 代码如上所示
急 在线等 谢谢!java想要读取excel中某以特定单元格的值,现在是循环读出所有的值,请帮忙修改一下
package com.excel.action; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; 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.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import jxl.Workbook; import jxl.format.Alignment; import jxl.format.Border; import jxl.format.BorderLineStyle; import jxl.format.Colour; import jxl.format.UnderlineStyle; import jxl.write.Label; import jxl.write.NumberFormats; import jxl.write.WritableCellFormat; import jxl.write.WritableFont; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook; import jxl.write.WriteException; import jxl.write.biff.RowsExceededException; public class JxlTable { private final static JxlTable jxlTable = new JxlTable(); public static JxlTable getInstance() { return jxlTable; } public JxlTable() { } public boolean createTable(String[][] body, String filePath,int rowLength) { boolean createFlag = true; WritableWorkbook book; try { // 根据路径生成excel文件 book = Workbook.createWorkbook(new File(filePath)); // 创建一个sheet名为"表格" WritableSheet sheet = book.createSheet("表格", 0); // 设置NO列宽度 sheet.setColumnView(1, 5); // 去掉整个sheet中的网格线 sheet.getSettings().setShowGridLines(false); Label tempLabel = null; // 表体输出 int bodyLen = body.length; String[][] bodyTempArr = body ; // 循环写入表体内容 for(int i=0;i<rowLength;i++) { for(int j=0;j<body[i].length;j++) { WritableCellFormat tempCellFormat = null; tempCellFormat = getBodyCellStyle(); if (tempCellFormat != null) { if (j == 0 || j == (bodyTempArr.length - 1)) { tempCellFormat.setAlignment(Alignment.CENTRE); } } tempLabel = new Label(1 + j, 2 + i, bodyTempArr[i][j], tempCellFormat); sheet.addCell(tempLabel); } } book.write(); book.close(); } catch (IOException e) { createFlag = false; System.out.println("EXCEL创建失败!"); e.printStackTrace(); } catch (RowsExceededException e) { createFlag = false; System.out.println("EXCEL单元设置创建失败!"); e.printStackTrace(); } catch (WriteException e) { createFlag = false; System.out.println("EXCEL写入失败!"); e.printStackTrace(); } return createFlag; } public WritableCellFormat getHeaderCellStyle() { WritableFont font = new WritableFont(WritableFont.createFont("宋体"), 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE); WritableCellFormat headerFormat = new WritableCellFormat( NumberFormats.TEXT); try { // 添加字体设置 headerFormat.setFont(font); // 设置单元格背景色:表头为黄色 headerFormat.setBackground(Colour.YELLOW); // 设置表头表格边框样式 // 整个表格线为粗线、黑色 headerFormat.setBorder(Border.ALL, BorderLineStyle.THICK, Colour.BLACK); // 表头内容水平居中显示 headerFormat.setAlignment(Alignment.CENTRE); } catch (WriteException e) { System.out.println("表头单元格样式设置失败!"); } return headerFormat; } public WritableCellFormat getBodyCellStyle() { WritableFont font = new WritableFont(WritableFont.createFont("宋体"), 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE); WritableCellFormat bodyFormat = new WritableCellFormat(font); try { // 设置单元格背景色:表体为白色 bodyFormat.setBackground(Colour.WHITE); // 设置表头表格边框样式 // 整个表格线为细线、黑色 bodyFormat .setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK); } catch (WriteException e) { System.out.println("表体单元格样式设置失败!"); } return bodyFormat; } /** * 读取Excel的内容,第一维数组存储的是一行中格列的值,二维数组存储的是多少个行 * @param file 读取数据的源Excel * @param ignoreRows 读取数据忽略的行数,比喻行头不需要读入 忽略的行数为1 * @return 读出的Excel中数据的内容 * @throws FileNotFoundException * @throws IOException */ public static String[][] getData(File file, int ignoreRows) throws FileNotFoundException, IOException { List<String[]> result = new ArrayList<String[]>(); int rowSize = 0; BufferedInputStream in = new BufferedInputStream(new FileInputStream( file)); // 打开HSSFWorkbook POIFSFileSystem fs = new POIFSFileSystem(in); HSSFWorkbook wb = new HSSFWorkbook(fs); HSSFCell cell = null; for (int sheetIndex = 0; sheetIndex < wb.getNumberOfSheets(); sheetIndex++) { HSSFSheet st = wb.getSheetAt(sheetIndex); // 第一行为标题,不取 for (int rowIndex = ignoreRows; rowIndex <= st.getLastRowNum(); rowIndex++) { HSSFRow row = st.getRow(rowIndex); if (row == null) { continue; } int tempRowSize = row.getLastCellNum() + 1; if (tempRowSize > rowSize) { rowSize = tempRowSize; } String[] values = new String[rowSize]; Arrays.fill(values, ""); boolean hasValue = false; for (short columnIndex = 0; columnIndex <= row.getLastCellNum(); columnIndex++) { String value = ""; cell = row.getCell(columnIndex); if (cell != null) { // 注意:一定要设成这个,否则可能会出现乱码 cell.setEncoding(HSSFCell.ENCODING_UTF_16); switch (cell.getCellType()) { case HSSFCell.CELL_TYPE_STRING: value = cell.getStringCellValue(); break; case HSSFCell.CELL_TYPE_NUMERIC: if (HSSFDateUtil.isCellDateFormatted(cell)) { Date date = cell.getDateCellValue(); if (date != null) { value = new SimpleDateFormat("yyyy-MM-dd") .format(date); } else { value = ""; } } else { value = new DecimalFormat("0").format(cell .getNumericCellValue()); } break; case HSSFCell.CELL_TYPE_FORMULA: // 导入时如果为公式生成的数据则无值 if (!cell.getStringCellValue().equals("")) { value = cell.getStringCellValue(); } else { value = cell.getNumericCellValue() + ""; } break; case HSSFCell.CELL_TYPE_BLANK: break; case HSSFCell.CELL_TYPE_ERROR: value = ""; break; case HSSFCell.CELL_TYPE_BOOLEAN: value = (cell.getBooleanCellValue() == true ? "Y" : "N"); break; default: value = ""; } } if (columnIndex == 0 && value.trim().equals("")) { break; } values[columnIndex] = rightTrim(value); hasValue = true; } if (hasValue) { result.add(values); } } } in.close(); String[][] returnArray = new String[result.size()][rowSize]; for (int i = 0; i < returnArray.length; i++) { returnArray[i] = (String[]) result.get(i); } return returnArray; } /** * 去掉字符串右边的空格 * @param str 要处理的字符串 * @return 处理后的字符串 */ public static String rightTrim(String str) { if (str == null) { return ""; } int length = str.length(); for (int i = length - 1; i >= 0; i--) { if (str.charAt(i) != 0x20) { break; } length--; } return str.substring(0, length); } public static void main(String[] args) throws Exception { File file = new File("F:/tomcat7/webapps/Excel/upload/3.xls"); String[][] result = getData(file, 1); int rowLength = result.length; System.out.println("rowLength="+rowLength); for(int i=0;i<rowLength;i++) { for(int j=0;j<result[i].length;j++) { System.out.print(result[i][j]+"\t\t"); } System.out.println(); } String[][] body = result; String filePath = "F:/tomcat7/webapps/Excel/upload/68.xls"; JxlTable testJxl = JxlTable.getInstance(); boolean flag = testJxl.createTable(body, filePath,rowLength); if (flag) { System.out.println("表格创建成功!!"); } } }
输出的表格 只有一组数据.怎么修改?
public boolean toOutList(List<Bill> billList) throws IOException { // 第一步,创建一个webbook,对应一个Excel文件 HSSFWorkbook wb = new HSSFWorkbook(); // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet HSSFSheet sheet = wb.createSheet("订单"); // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short HSSFRow row = sheet.createRow((int) 0); // 第四步,创建单元格,并设置值表头 设置表头居中 HSSFCellStyle style = wb.createCellStyle(); style.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 创建一个居中格式 HSSFCell cell = row.createCell(0); cell.setCellValue("订单编码"); cell.setCellStyle(style); cell = row.createCell( 1); cell.setCellValue("患者姓名"); cell.setCellStyle(style); cell = row.createCell( 2); cell.setCellValue("医护姓名"); cell.setCellStyle(style); cell = row.createCell( 3); cell.setCellValue("账单金额"); cell.setCellStyle(style); // 第五步,写入实体数据, int x=billList.size(); for (int i = 0; i < x; i++){ Bill b= billList.get(i); // 第四步,创建单元格,并设置值 row.createCell(0).setCellValue( b.getOrderNum()); row.createCell(1).setCellValue(b.getPaName()); row.createCell(2).setCellValue(b.getYihuName()); row.createCell(3).setCellValue(b.getBillMoney()); System.out.println(b); } FileOutputStream fout = new FileOutputStream("F:/students.xls"); wb.write(fout); fout.flush(); fout.close(); return true; } } ``` ```
导出execl文件弹不出下载框
package com.dogoserver.tools; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.List; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import com.dogoserver.user.beans.UserAble; public class UserExeclUtil { public static void createUserAbleExecl(List<UserAble> listUserAble,HttpServletResponse response) throws IOException{ // 创建excel工作簿 Workbook wb = new HSSFWorkbook(); // 创建第一个sheet(页) Sheet sheet = (Sheet) wb.createSheet(); //创建第行 Row row = sheet.createRow((short) 0); Cell serialNo = row.createCell(0); serialNo.setCellValue("序号"); Cell userName = row.createCell(1); userName.setCellValue("用户姓名"); Cell SCP = row.createCell(2); SCP.setCellValue("送检人"); Cell focus = row.createCell(3); focus.setCellValue("专注能力"); Cell selfControl = row.createCell(4); selfControl.setCellValue("自控能力"); Cell language = row.createCell(5); language.setCellValue("语言能力"); Cell music = row.createCell(6); music.setCellValue("音乐辨识能力"); Cell memory = row.createCell(7); memory.setCellValue("情景记忆能力"); Cell eq = row.createCell(8); eq.setCellValue("情绪控制能力"); Cell learn = row.createCell(9); learn.setCellValue("学习能力"); Cell create = row.createCell(10); create.setCellValue("创造能力"); Cell math = row.createCell(11); math.setCellValue("数学能力"); Cell sport = row.createCell(12); sport.setCellValue("运动能力"); Cell wit = row.createCell(13); wit.setCellValue("智力"); int rowNo = 1; for(UserAble userAble: listUserAble){ Row rowInfo = sheet.createRow(rowNo); Cell serialNoInfo = row.createCell(0); serialNoInfo.setCellValue(rowNo); Cell userNameInfo = rowInfo.createCell(1); userNameInfo.setCellValue(userAble.getU_name()); Cell SCPInfo = row.createCell(2); SCPInfo.setCellValue(userAble.getSend_check_person()); Cell focusInfo = row.createCell(3); focusInfo.setCellValue(userAble.getFocus()); Cell selfControlInfo = row.createCell(4); selfControlInfo.setCellValue(userAble.getSelf_control()); Cell languageInfo = row.createCell(5); languageInfo.setCellValue(userAble.getLanguage()); Cell musicInfo = row.createCell(6); musicInfo.setCellValue(userAble.getMusic()); Cell memoryInfo = row.createCell(7); memoryInfo.setCellValue(userAble.getScene_memory()); Cell eqInfo = row.createCell(8); eqInfo.setCellValue(userAble.getEmotions_control()); Cell learnInfo = row.createCell(9); learnInfo.setCellValue(userAble.getLearn_ab()); Cell createInfo = row.createCell(10); createInfo.setCellValue(userAble.getCreate_ab()); Cell mathInfo = row.createCell(11); mathInfo.setCellValue(userAble.getMath()); Cell sportInfo = row.createCell(12); sportInfo.setCellValue(userAble.getSport()); Cell witInfo = row.createCell(13); witInfo.setCellValue(userAble.getWit()); rowNo++; } ByteArrayOutputStream os = new ByteArrayOutputStream(); try { wb.write(os); } catch (IOException e) { e.printStackTrace(); } byte[] content = os.toByteArray(); InputStream is = new ByteArrayInputStream(content); // 设置response参数,可以打开下载页面 response.reset(); response.setContentType("application/vnd.ms-excel;charset=utf-8"); response.setHeader("Content-Disposition", "attachment;filename=" + new String(("aaa" + ".xls").getBytes(), "iso-8859-1")); response.setContentType("application/octet-stream;charset=UTF-8"); ServletOutputStream out = response.getOutputStream(); BufferedInputStream bis = null; BufferedOutputStream bos = null; try { bis = new BufferedInputStream(is); bos = new BufferedOutputStream(out); byte[] buff = new byte[2048]; int bytesRead; // Simple read/write loop. while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) { bos.write(buff, 0, bytesRead); } } catch (final IOException e) { throw e; } finally { if (bis != null) bis.close(); if (bos != null) bos.close(); } } }
excell存盘错误找不到TreeBidiMap
NoClassDefFoundError: org/apache/commons/collections4/bidimap/TreeBidiMap 目前我报错的版本: hamcrest-core-1.3 junit-4.12 ooxml-schemas-1.1.jar(网上说下载解决依赖,引入项目还是报错,项目确实没有这个类) poi-3.17.jar jdk1.8.0_131(jdk应该没关系) problem中的报错: The project was not built since its build path is incomplete. Cannot find the class file for org.apache.tools.ant.taskdefs.Typedef. Fix the build path then try building this project junit中的报错: java.lang.NoClassDefFoundError: org/apache/commons/collections4/bidimap/TreeBidiMap at org.apache.poi.hpsf.Section.<init>(Section.java:178) at org.apache.poi.hpsf.MutableSection.<init>(MutableSection.java:41) at org.apache.poi.hpsf.PropertySet.init(PropertySet.java:494) at org.apache.poi.hpsf.PropertySet.<init>(PropertySet.java:196) at org.apache.poi.hpsf.MutablePropertySet.<init>(MutablePropertySet.java:44) at org.apache.poi.hpsf.SpecialPropertySet.<init>(SpecialPropertySet.java:47) at org.apache.poi.hpsf.DocumentSummaryInformation.<init>(DocumentSummaryInformation.java:99) at org.apache.poi.hpsf.PropertySetFactory.create(PropertySetFactory.java:116) at org.apache.poi.POIDocument.getPropertySet(POIDocument.java:236) ``` package TestCase; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Date; import java.util.List; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFName; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.openqa.selenium.WebDriver; /** * MainRemark TODO * Modual TODO * @author *** * TestCaseTestExcellMaker.java * 上午11:13:36 * */ public class TestExcellMaker { @Before public void setUp() throws Exception { System.out.println("make excell file testcase"); } @After public void tearDown() throws Exception { } WebDriver driver; @Test public void test() throws IOException { // ------ // 创建HSSFWorkbook对象 try { HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream("***.xls")); HSSFSheet sheet = wb.getSheet("Sheet1");//得到表一 HSSFRow row = sheet.getRow(7); //得到表一 行7 下标为0 HSSFCell cell = row.getCell(2); //得到表一 列7 下标为0 System.out.println(cell.getStringCellValue());//输出C8的值 cell.setCellValue(""); //清空 System.out.println(cell.getStringCellValue()); cell.setCellValue("SeleN"+(new Date()).getTime()+""); //程序设置成功 System.out.println(cell.getStringCellValue()); //HPBCSele5958 // 输出Excel文件 FileOutputStream output = new FileOutputStream("***.xls"); wb.write(output); output.close(); // wb.close(); } catch (Exception e) { e.printStackTrace(); } } @Ignore @Test public void printXlsCoulums() throws FileNotFoundException, IOException{ HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream("***.xls")); List<HSSFName> allNames = wb.getAllNames(); HSSFSheet sheet = wb.getSheet("Sheet1"); for(int rowPositon=0;rowPositon<sheet.getPhysicalNumberOfRows();rowPositon++){ int cellTotal=sheet.getRow(rowPositon).getPhysicalNumberOfCells(); for(int cell=0;cell<cellTotal;cell++){ HSSFCell target = sheet.getRow(rowPositon).getCell(cell); if(target != null){ System.out.println("Row:"+rowPositon+" / cell:"+cell+" "+target); } } } } } ```
String数组之间如何传值
package com.excel.action; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; 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.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import jxl.Workbook; import jxl.format.Alignment; import jxl.format.Border; import jxl.format.BorderLineStyle; import jxl.format.Colour; import jxl.format.UnderlineStyle; import jxl.write.Label; import jxl.write.NumberFormats; import jxl.write.WritableCellFormat; import jxl.write.WritableFont; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook; import jxl.write.WriteException; import jxl.write.biff.RowsExceededException; public class JxlTable { private final static JxlTable jxlTable = new JxlTable(); public static JxlTable getInstance() { return jxlTable; } public JxlTable() { } public boolean createTable(String[] body, String filePath) { boolean createFlag = true; WritableWorkbook book; try { // 根据路径生成excel文件 book = Workbook.createWorkbook(new File(filePath)); // 创建一个sheet名为"表格" WritableSheet sheet = book.createSheet("表格", 0); // 设置NO列宽度 sheet.setColumnView(1, 5); // 去掉整个sheet中的网格线 sheet.getSettings().setShowGridLines(false); Label tempLabel = null; // 表体输出 int bodyLen = body.length; // 循环写入表体内容 for (int j = 0; j < bodyLen; j++) { String[] bodyTempArr = body[j].split(","); for (int k = 0; k < bodyTempArr.length; k++) { WritableCellFormat tempCellFormat = null; tempCellFormat = getBodyCellStyle(); if (tempCellFormat != null) { if (k == 0 || k == (bodyTempArr.length - 1)) { tempCellFormat.setAlignment(Alignment.CENTRE); } } tempLabel = new Label(1 + k, 2 + j, bodyTempArr[k], tempCellFormat); sheet.addCell(tempLabel); } } book.write(); book.close(); } catch (IOException e) { createFlag = false; System.out.println("EXCEL创建失败!"); e.printStackTrace(); } catch (RowsExceededException e) { createFlag = false; System.out.println("EXCEL单元设置创建失败!"); e.printStackTrace(); } catch (WriteException e) { createFlag = false; System.out.println("EXCEL写入失败!"); e.printStackTrace(); } return createFlag; } public WritableCellFormat getHeaderCellStyle() { WritableFont font = new WritableFont(WritableFont.createFont("宋体"), 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE); WritableCellFormat headerFormat = new WritableCellFormat( NumberFormats.TEXT); try { // 添加字体设置 headerFormat.setFont(font); // 设置单元格背景色:表头为黄色 headerFormat.setBackground(Colour.YELLOW); // 设置表头表格边框样式 // 整个表格线为粗线、黑色 headerFormat.setBorder(Border.ALL, BorderLineStyle.THICK, Colour.BLACK); // 表头内容水平居中显示 headerFormat.setAlignment(Alignment.CENTRE); } catch (WriteException e) { System.out.println("表头单元格样式设置失败!"); } return headerFormat; } public WritableCellFormat getBodyCellStyle() { WritableFont font = new WritableFont(WritableFont.createFont("宋体"), 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE); WritableCellFormat bodyFormat = new WritableCellFormat(font); try { // 设置单元格背景色:表体为白色 bodyFormat.setBackground(Colour.WHITE); // 设置表头表格边框样式 // 整个表格线为细线、黑色 bodyFormat .setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK); } catch (WriteException e) { System.out.println("表体单元格样式设置失败!"); } return bodyFormat; } /** * 读取Excel的内容,第一维数组存储的是一行中格列的值,二维数组存储的是多少个行 * @param file 读取数据的源Excel * @param ignoreRows 读取数据忽略的行数,比喻行头不需要读入 忽略的行数为1 * @return 读出的Excel中数据的内容 * @throws FileNotFoundException * @throws IOException */ public static String[][] getData(File file, int ignoreRows) throws FileNotFoundException, IOException { List<String[]> result = new ArrayList<String[]>(); int rowSize = 0; BufferedInputStream in = new BufferedInputStream(new FileInputStream( file)); // 打开HSSFWorkbook POIFSFileSystem fs = new POIFSFileSystem(in); HSSFWorkbook wb = new HSSFWorkbook(fs); HSSFCell cell = null; for (int sheetIndex = 0; sheetIndex < wb.getNumberOfSheets(); sheetIndex++) { HSSFSheet st = wb.getSheetAt(sheetIndex); // 第一行为标题,不取 for (int rowIndex = ignoreRows; rowIndex <= st.getLastRowNum(); rowIndex++) { HSSFRow row = st.getRow(rowIndex); if (row == null) { continue; } int tempRowSize = row.getLastCellNum() + 1; if (tempRowSize > rowSize) { rowSize = tempRowSize; } String[] values = new String[rowSize]; Arrays.fill(values, ""); boolean hasValue = false; for (short columnIndex = 0; columnIndex <= row.getLastCellNum(); columnIndex++) { String value = ""; cell = row.getCell(columnIndex); if (cell != null) { // 注意:一定要设成这个,否则可能会出现乱码 cell.setEncoding(HSSFCell.ENCODING_UTF_16); switch (cell.getCellType()) { case HSSFCell.CELL_TYPE_STRING: value = cell.getStringCellValue(); break; case HSSFCell.CELL_TYPE_NUMERIC: if (HSSFDateUtil.isCellDateFormatted(cell)) { Date date = cell.getDateCellValue(); if (date != null) { value = new SimpleDateFormat("yyyy-MM-dd") .format(date); } else { value = ""; } } else { value = new DecimalFormat("0").format(cell .getNumericCellValue()); } break; case HSSFCell.CELL_TYPE_FORMULA: // 导入时如果为公式生成的数据则无值 if (!cell.getStringCellValue().equals("")) { value = cell.getStringCellValue(); } else { value = cell.getNumericCellValue() + ""; } break; case HSSFCell.CELL_TYPE_BLANK: break; case HSSFCell.CELL_TYPE_ERROR: value = ""; break; case HSSFCell.CELL_TYPE_BOOLEAN: value = (cell.getBooleanCellValue() == true ? "Y" : "N"); break; default: value = ""; } } if (columnIndex == 0 && value.trim().equals("")) { break; } values[columnIndex] = rightTrim(value); hasValue = true; } if (hasValue) { result.add(values); } } } in.close(); String[][] returnArray = new String[result.size()][rowSize]; for (int i = 0; i < returnArray.length; i++) { returnArray[i] = (String[]) result.get(i); } return returnArray; } /** * 去掉字符串右边的空格 * @param str 要处理的字符串 * @return 处理后的字符串 */ public static String rightTrim(String str) { if (str == null) { return ""; } int length = str.length(); for (int i = length - 1; i >= 0; i--) { if (str.charAt(i) != 0x20) { break; } length--; } return str.substring(0, length); } public static void main(String[] args) throws Exception { File file = new File("F:/tomcat7/webapps/Excel/upload/3.xls"); String[][] result = getData(file, 1); int rowLength = result.length; for(int i=0;i<rowLength;i++) { for(int j=0;j<result[i].length;j++) { System.out.print(result[i][j]+"\t\t"); } System.out.println(); } String[][] body = result; //如何传值? String filePath = "F:/tomcat7/webapps/Excel/upload/3333.xls"; JxlTable testJxl = JxlTable.getInstance(); boolean flag = testJxl.createTable(body, filePath); /////在这里报错 如何传值 求助 if (flag) { System.out.println("表格创建成功!!"); } } }
win7系统报错getOutputStream() has already been called for this response.但是xp系统没问题...
<div class="iteye-blog-content-contain" style="font-size: 14px;"> <p>    最近这个问题搞的很头疼,debug过了,action中执行到return "SUCCESS"就报出错误堆栈了,所以应该是jsp文件写的有问题,JSP文件中根本就没有发现getOutputStream(),引入的文件中也没有</p> <p>    而且更奇怪的是,在我开发的机器上和经理的电脑上都报这个错误,但是在业务的员工的电脑上没出现这个错误,所以推测是代码的某些部分可能存在不兼容的问题,因为我的电脑和经理的电脑是win7的系统,业务的员工的电脑是XP的系统,然后再测试人员的电脑上面进xp的虚拟机也不会报这样的问题</p> <p>    但是实在看不出来代码存在什么样的问题,百度了N条记录,说是加入2行代码的什么的,但是JSP文件中压根就没有getOutputStream()的语句存在.</p> <p>     贴上几段代码吧,希望大神能帮忙分析下问题:</p> <p>     首先是错误堆栈(win7系统):</p> <p>    </p> <pre name="code" class="java">2013-1-24 16:26:02 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet default threw exception java.lang.IllegalStateException: getOutputStream() has already been called for this response at org.apache.catalina.connector.Response.getWriter(Response.java:601) at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:196) at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:157) at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125) at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:118) at org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:326) at org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:342) at org.apache.jsp.jsp.query.integrative.integrative_jsp._jspx_meth_c_005fotherwise_005f1(integrative_jsp.java:1180) at org.apache.jsp.jsp.query.integrative.integrative_jsp._jspx_meth_c_005fchoose_005f1(integrative_jsp.java:1119) at org.apache.jsp.jsp.query.integrative.integrative_jsp._jspx_meth_c_005fforEach_005f1(integrative_jsp.java:1079) at org.apache.jsp.jsp.query.integrative.integrative_jsp._jspService(integrative_jsp.java:362) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:594) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:505) at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:141) at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178) at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:343) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:213) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.intercept(ParametersInterceptor.java:161) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.intercept(PrepareInterceptor.java:115) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at com.mangocity.ds.framework.common.controller.ActionInfoInterceptor.intercept(ActionInfoInterceptor.java:55) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:507) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:106) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274) at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148) at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685) at java.lang.Thread.run(Thread.java:619) </pre> <p> action的代码,请求到的方法:</p> <p>   </p> <pre name="code" class="java">/** * 2008-05-06 V2.6.0 SR029 常锐 导出配送单信息 * * @return * @throws Exception */ public String exportExcelDeliveryBill() throws Exception { init(); List&lt;String&gt; unitIdList = new ArrayList&lt;String&gt;(); List&lt;String&gt; centerIdList = new ArrayList&lt;String&gt;(); // 判断是否有权限 if (null != getSystemType().getUnitList() &amp;&amp; 0 &lt; getSystemType().getUnitList().size() &amp;&amp; null != getSystemType().getCenterList() &amp;&amp; 0 &lt; getSystemType().getCenterList().size()) { for (int i = 0; i &lt; getSystemType().getUnitList().size(); i++) { unitIdList.add(((DeliveryUnit) getSystemType().getUnitList().get(i)).getId()); } for (int i = 0; i &lt; getSystemType().getCenterList().size(); i++) { centerIdList.add(((DeliveryCenter) getSystemType().getCenterList().get(i)).getId()); } showOther = ((IntegrativeService) getDBService()).getDeliveryBillList(getParams(), getPage(), unitIdList, centerIdList); } showDeliveryList = "yes"; HttpServletResponse response = super.getHttpServletResponse(); response.reset(); response.setContentType("application/vnd.ms-excel");// "application/msexcel" response.setCharacterEncoding("GBK"); response.setHeader("Content-disposition", "attachment;filename=配送单综合查询.xsl"); OutputStream outStrean = response.getOutputStream(); // 获取addressList List addressList = this.getSystemType().getAreaAddressList(); HSSFWorkbook demoWorkBook = ((IntegrativeService) getDBService()).exportExcelDeliveryBill( getParams(), unitIdList, centerIdList, addressList); demoWorkBook.write(outStrean); outStrean.flush(); outStrean.close(); return SUCCESS; }</pre> <p> </p> <p>返回到的JSP页面(发出请求的也是这个页面):</p> <p>   </p> <pre name="code" class="java">&lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&gt; &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt; &lt;html&gt; &lt;head&gt; &lt;%@ page import="org.apache.poi.hssf.usermodel.HSSFWorkbook" %&gt; &lt;%@ page import="com.opensymphony.xwork2.util.*" %&gt; &lt;%@ include file="/jsp/common/commonheader.jsp"%&gt; &lt;script src="&lt;%=webPath%&gt;/js/query.js"&gt;&lt;/script&gt; &lt;script src="&lt;%=webPath%&gt;/js/operate.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function exportExcel() { if(checkQueryForm()) { queryform.action ="IntegrativeAction_exportExcelDeliveryBill.do"; queryform.submit(); } else return false; } function submitForm(){ if(checkQueryForm()) { queryform.action ="IntegrativeAction_queryByDeliveryBill.do"; queryform.submit(); } else return false; } function checkQueryForm() { if(!validate_form(queryform))return false; if(!checkDeliveryDate("billcreatedatebegin","billcreatedateend")){ return false; } if(!checkDeliveryDate("deliverydatebegin","deliverydateend")){ return false; } if(!checkDeliveryDate("deliveryendbegin","deliveryendend")){ return false; } var deliveryCD = queryform.elements["params.deliveryCD"].value; var orderCD = queryform.elements["params.orderCD"].value; var billcreatedatebegin = document.getElementById("billcreatedatebegin").value; var deliverydatebegin = document.getElementById("deliverydatebegin").value; var deliveryendbegin = document.getElementById("deliveryendbegin").value; var billcreatedateend = document.getElementById("billcreatedateend").value; var deliverydateend = document.getElementById("deliverydateend").value; var deliveryendend = document.getElementById("deliveryendend").value; var deliveryCenter = document.getElementById("deliveryCenter").value; if(deliveryCD=="" &amp;&amp; orderCD==""){ if(deliveryCenter==""){ alert("请使用以下三种方式中的一种进行查询:\n\n1.配送中心+配送单创建时间\n2.配送中心+预约配送时间\n3.配送中心+配送完成时间"); return false; } if(billcreatedatebegin=="" &amp;&amp; deliverydatebegin=="" &amp;&amp; deliveryendbegin=="") { alert("请使用以下三种方式中的一种进行查询:\n\n1.配送中心+配送单创建时间或\n2.配送中心+预约配送时间或\n3.配送中心+配送完成时间"); return false; } } if(better_time(billcreatedatebegin,billcreatedateend)&gt;180){ alert(document.getElementById("billcreatedateend").title+"不应超过六个月!"); return false; } if(better_time(deliverydatebegin,deliverydateend)&gt;180){ alert(document.getElementById("deliverydateend").title+"不应超过六个月!"); return false; } if(better_time(deliveryendbegin,deliveryendend)&gt;180){ alert(document.getElementById("deliveryendend").title+"不应超过六个月!"); return false; } return true; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name="queryform" action="IntegrativeAction_queryByDeliveryBill.do" method="post"&gt; &lt;table width="20%" border="0" cellpadding="3" cellspacing="0"&gt; &lt;tr&gt; &lt;td height="18" &gt;&lt;strong&gt;&lt;img src="&lt;%=webPath%&gt;/images/arrow.gif" width="9" height="9"&gt; 综合查询&lt;/strong&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;table width="100%" class="table_bg" align="center" border="0" cellpadding="1" cellspacing="0"&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="hidden" id="showother" value="${showOther}" /&gt; &lt;input type="hidden" id="showotherinfo" value="yesorno" /&gt; &lt;input type="hidden" id="showdeliverylist" value="${showDeliveryList }" /&gt; &lt;input type="hidden" id="urgencyCopy" value="${params.urgency }" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td height="18"&gt;&lt;img src="&lt;%=webPath%&gt;/images/a2.gif" width="9" height="9"&gt; &lt;a href="#" onClick="javascript:playTableDelivery('deliverTbl')"&gt; &lt;font color="#FF9933"&gt;配送单信息&lt;/font&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;table width="100%" class="table_bg" align="center" border="0" cellpadding="1" cellspacing="0" style="display:block" id="deliverTbl"&gt; &lt;tr class="search_bg"&gt; &lt;td width="15%"&gt;配送单编号&lt;/td&gt; &lt;td width="32%"&gt;&lt;input type="text" name="params.deliveryCD" value="${params.deliveryCD}" maxlength="50"&gt;&lt;/td&gt; &lt;td width="18%"&gt;订单编号&lt;/td&gt; &lt;td width="35%"&gt;&lt;input type="text" name="params.orderCD" value="${params.orderCD}" maxlength="50"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td width="15%"&gt;订单来源&lt;/td&gt; &lt;td width="32%"&gt;&lt;select id="billResouceOne" name="params.billResouce"&gt; &lt;option value=""&gt;-全部-&lt;/option&gt; &lt;c:forEach var="billResouce" items="${systemType.billResouce}"&gt; &lt;c:choose&gt; &lt;c:when test="${billResouce.value == params.billResouce}"&gt; &lt;option value="${billResouce.value}" selected&gt;${billResouce.label}&lt;/option&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;option value="${billResouce.value}"&gt;${billResouce.label}&lt;/option&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/c:forEach&gt; &lt;/select&gt;&lt;/td&gt; &lt;td&gt;配送方式&lt;/td&gt; &lt;td&gt;&lt;select name="params.deliveryType"&gt; &lt;option value=""&gt;-全部-&lt;/option&gt; &lt;c:forEach var="deliveryType" items="${systemType.deliveryType}"&gt; &lt;c:choose&gt; &lt;c:when test="${deliveryType.value == params.deliveryType}"&gt; &lt;option value="${deliveryType.value}" selected&gt;${deliveryType.label}&lt;/option&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;option value="${deliveryType.value}"&gt;${deliveryType.label}&lt;/option&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/c:forEach&gt; &lt;/select&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;配送中心&lt;/td&gt; &lt;td&gt;&lt;select name="params.centerCD" id="deliveryCenter"&gt; &lt;option value=""&gt;--全部--&lt;/option&gt; &lt;/select&gt;&lt;/td&gt; &lt;td&gt;配送单位&lt;/td&gt; &lt;td&gt;&lt;select name="params.deliveryUnitCD" id="deliveryUnit"&gt; &lt;option value=""&gt;--全部--&lt;/option&gt; &lt;/select&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;配送任务状态&lt;/td&gt; &lt;td&gt;&lt;select name="params.deliveryState"&gt; &lt;option value=""&gt;-全部-&lt;/option&gt; &lt;c:forEach var="deliveryStateTwo" items="${systemType.deliveryState}"&gt; &lt;c:choose&gt; &lt;c:when test="${deliveryStateTwo.value == params.deliveryState}"&gt; &lt;option value="${deliveryStateTwo.value}" selected&gt;${deliveryStateTwo.label}&lt;/option&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;option value="${deliveryStateTwo.value}"&gt;${deliveryStateTwo.label}&lt;/option&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/c:forEach&gt; &lt;/select&gt;&lt;/td&gt; &lt;td&gt;收款任务状态&lt;/td&gt; &lt;td&gt;&lt;select name="params.gatheringState"&gt; &lt;option value=""&gt;-全部-&lt;/option&gt; &lt;c:forEach var="deliveryState" items="${systemType.deliveryState}"&gt; &lt;c:choose&gt; &lt;c:when test="${deliveryState.value == params.gatheringState}"&gt; &lt;option value="${deliveryState.value}" selected&gt;${deliveryState.label}&lt;/option&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;option value="${deliveryState.value}"&gt;${deliveryState.label}&lt;/option&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/c:forEach&gt; &lt;/select&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;配送员姓名&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.delivererName" value="${params.delivererName}" maxlength="50"&gt;&lt;/td&gt; &lt;td&gt;收件人&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.addresseeName" value="${params.addresseeName}" maxlength="50"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;配送接票时间&lt;/td&gt; &lt;td&gt;&lt;input type="text" id="deliveryconnect" name="params.deliveryConnect" value="${params.deliveryConnect }" size="15"&gt; &lt;a href="javascript:showCalendar('deliveryconnect',false,'deliveryconnect')"&gt; &lt;img src="&lt;%=webPath%&gt;/images/i_date.gif" width="29" height="22" align="middle" border=0&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;收件人联系电话&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.addresseePhone" value="${params.addresseePhone}" maxlength="50"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;会员编号&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.memberName" value="${params.memberName}" maxlength="50"&gt;&lt;/td&gt; &lt;td&gt;收件人手机号&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.addresseeMobile" value="${params.addresseeMobile}" maxlength="50"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;第三方收件人&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.linkman" value="${params.linkman}" maxlength="50"&gt;&lt;/td&gt; &lt;td&gt;第三方收件人联系电话&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.linkmanPhone" value="${params.linkmanPhone}" maxlength="50"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;配送单创建时间&lt;/td&gt; &lt;td&gt;&lt;input type="text" size="10" id="billcreatedatebegin" name="params.billCreateDateBegin" value="${params.billCreateDateBegin }" dataType="date"&gt; &lt;a href="javascript:showCalendar('billcreatedatebegin',false,'billcreatedatebegin','billcreatedateend','billcreatedateend')"&gt; &lt;img src="&lt;%=webPath%&gt;/images/i_date.gif" width="29" height="22" align="middle" border=0&gt;&lt;/a&gt; &lt;input type="text" size="10" id="billcreatedateend" name="params.billCreateDateEnd" value="${params.billCreateDateEnd }" title="配送单创建时间" dataType="date"&gt; &lt;a href="javascript:showCalendar('billcreatedateend',false,'billcreatedateend')"&gt; &lt;img src="&lt;%=webPath%&gt;/images/i_date.gif" width="29" height="22" align="middle" border=0&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;预约配送时间&lt;/td&gt; &lt;td&gt;&lt;input type="text" size="10" id="deliverydatebegin" name="params.deliveryDateBegin" value="${params.deliveryDateBegin}" dataType="date"&gt; &lt;a href="javascript:showCalendar('deliverydatebegin',false,'deliverydatebegin','deliverydateend','deliverydateend')"&gt; &lt;img src="&lt;%=webPath%&gt;/images/i_date.gif" width="29" height="22" align="middle" border=0&gt;&lt;/a&gt; &lt;input type="text" size="10" id="deliverydateend" name="params.deliveryDateEnd" value="${params.deliveryDateEnd }" title="预约配送时间" dataType="date"&gt; &lt;a href="javascript:showCalendar('deliverydateend',false,'deliverydateend')"&gt; &lt;img src="&lt;%=webPath%&gt;/images/i_date.gif" width="29" height="22" align="middle" border=0&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td&gt;紧急程度&lt;/td&gt; &lt;td&gt;&lt;select id="urgencyOne" name="params.urgency"&gt; &lt;option value=""&gt;-全部-&lt;/option&gt; &lt;c:forEach var="urgency" items="${systemType.urgencyType}"&gt; &lt;c:choose&gt; &lt;c:when test="${urgency.value == params.urgency}"&gt; &lt;option value="${urgency.value}" selected&gt;${urgency.label}&lt;/option&gt; &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;option value="${urgency.value}"&gt;${urgency.label}&lt;/option&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/c:forEach&gt; &lt;/select&gt;&lt;/td&gt; &lt;td&gt;配送完成时间&lt;/td&gt; &lt;td&gt;&lt;input type="text" size="10" id="deliveryendbegin" name="params.deliveryEndBegin" value="${params.deliveryEndBegin}" dataType="date"&gt; &lt;a href="javascript:showCalendar('deliveryendbegin',false,'deliveryendbegin','deliveryendend','deliveryendend')"&gt; &lt;img src="&lt;%=webPath%&gt;/images/i_date.gif" width="29" height="22" align="middle" border=0&gt;&lt;/a&gt; &lt;input type="text" size="10" id="deliveryendend" name="params.deliveryEndEnd" value="${params.deliveryEndEnd }" title="配送完成时间" dataType="date"&gt; &lt;a href="javascript:showCalendar('deliveryendend',false,'deliveryendend')"&gt; &lt;img src="&lt;%=webPath%&gt;/images/i_date.gif" width="29" height="22" align="middle" border=0&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td&gt;配送地址&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="params.deliveryAddress" value="${params.deliveryAddress}" maxlength="100"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td height="18" colspan="4" valign="middle"&gt;&lt;img src="&lt;%=webPath%&gt;/images/a2.gif" width="9" height="9"&gt; &lt;a href="#" onClick="javascript:playTableOther('otherTbl')"&gt; &lt;font color="#FF9933"&gt;其他信息&lt;/font&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;table width="100%" class="table_bg " align="center" border="0" cellpadding="1" cellspacing="0" style="display:none" id="otherTbl"&gt; &lt;tr class="search_bg"&gt; &lt;td width="15%"&gt;异常问题大类&lt;/td&gt; &lt;td&gt;&lt;select name="params.questionBigCode" id="billProblemBigType"&gt; &lt;option value=""&gt;--全部--&lt;/option&gt; &lt;/select&gt;&lt;/td&gt; &lt;td width="15%"&gt;异常问题小类&lt;/td&gt; &lt;td&gt;&lt;select name="params.questionSmallCode" id="billProblemSmallType" style="display:inline;width:340"&gt; &lt;option value=""&gt;--全部--&lt;/option&gt; &lt;/select&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td width="15%"&gt;问题处理&lt;/td&gt; &lt;td width="35%"&gt;&lt;input type="text" name="params.processMethod" value="${params.processMethod }"&gt;&lt;/td&gt; &lt;td&gt;建单原因&lt;/td&gt; &lt;td colspan="3"&gt;&lt;input type="text" name="params.createBillCause" value="${params.createBillCause }"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="search_bg"&gt; &lt;td align="right" colspan="4"&gt; &lt;input type="button" class="btn" value="导 出 EXCEL" style="width:100px" onClick="exportExcel();"&gt; &amp;nbsp; &lt;input type="submit" class="btn" value="查 询" onClick="return submitForm();"&gt; &amp;nbsp; &lt;input type="button" class="btn" value="重 置" onClick="javascript:clearForm('queryform');"&gt; &amp;nbsp; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;table width="20%" border="0" cellpadding="3" cellspacing="0"&gt; &lt;tr&gt; &lt;td height="18" &gt;&lt;strong&gt;&lt;img src="&lt;%=webPath%&gt;/images/arrow.gif" width="9" height="9"&gt; 结果列表&lt;/strong&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;table width="100%" class="table_bg" align="center" border="1" cellpadding="1" cellspacing="0" id="orderlist"&gt; &lt;tr align="center" class="sub_bg"&gt; &lt;td width="1%"&gt;紧急度&lt;/td&gt; &lt;td width="10%"&gt;订单编号&lt;br&gt;订单类型&lt;/td&gt; &lt;td width="11%"&gt;配送单编号&lt;br&gt;配送单创建时间&lt;/td&gt; &lt;td width="8%"&gt;会员类型&lt;br&gt;VIP级别&lt;/td&gt; &lt;td width="6%"&gt;配送单位&lt;/td&gt; &lt;td width="9%"&gt;配送方式&lt;br&gt;任务类型&lt;/td&gt; &lt;td width="8%"&gt;配送城市&lt;br&gt;/城区&lt;/td&gt; &lt;td width="10%"&gt;配送地址&lt;/td&gt; &lt;td width="10%"&gt;配送时间&lt;/td&gt; &lt;td width="8%"&gt;配送员姓名&lt;br&gt;联系电话&lt;/td&gt; &lt;td width="7%"&gt;截余时间&lt;/td&gt; &lt;td width="6%"&gt;配送任务状态&lt;/td&gt; &lt;td width="6%"&gt;收款任务状态&lt;/td&gt; &lt;/tr&gt; &lt;c:forEach var="deliveryBill" items="${page.pageList}"&gt; &lt;tr align="center" class="row_bg"&gt; &lt;td&gt;&lt;c:forEach var="t" items="${systemType.urgencyType}"&gt; &lt;c:if test="${deliveryBill[0].urgency == t.value}"&gt; &lt;c:if test="${t.label == '紧急'}"&gt; &lt;img src="${webPath}/images/dot_11.gif"&gt;&lt;/c:if&gt; &lt;c:if test="${t.label == '非常紧急'}"&gt; &lt;img src="${webPath}/images/dot_12.gif"&gt;&lt;/c:if&gt; &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;/td&gt; &lt;td&gt;${deliveryBill[0].orderCD}&lt;br&gt; &lt;c:forEach var="b" items="${systemType.billResouce}"&gt; &lt;c:if test="${deliveryBill[0].billResouce == b.value}"&gt; ${b.label} &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;/td&gt; &lt;td&gt;&lt;a href="#" onClick="viewDetailForQuery('${deliveryBill[0].id}','9')"&gt;${deliveryBill[0].deliveryCD}&lt;/a&gt;&lt;br&gt;${deliveryBill[0].entityCreateDate} ${fn:substring(deliveryBill[0].entityCreateTime, 0, 5)}&lt;/td&gt; &lt;td&gt; &lt;c:forEach var="memberType" items="${systemType.memberType}"&gt; &lt;c:if test="${memberType.value eq deliveryBill[0].memberLevel}"&gt; ${memberType.label} &lt;/c:if&gt; &lt;/c:forEach&gt;&lt;br&gt; &lt;c:choose&gt; &lt;c:when test="${deliveryBill[0].vipType eq '1'}"&gt; &lt;font class="redone"&gt;*&lt;/font&gt; &lt;/c:when&gt; &lt;c:when test="${deliveryBill[0].vipType eq '2'}"&gt; &lt;font class="redone"&gt;**&lt;/font&gt; &lt;/c:when&gt; &lt;c:when test="${deliveryBill[0].vipType eq '3'}"&gt; &lt;font class="redone"&gt;***&lt;/font&gt; &lt;/c:when&gt; &lt;c:when test="${deliveryBill[0].vipType eq '4'}"&gt; &lt;font class="redone"&gt;****&lt;/font&gt; &lt;/c:when&gt; &lt;c:when test="${deliveryBill[0].vipType eq '5'}"&gt; &lt;font class="redone"&gt;*****&lt;/font&gt; &lt;/c:when&gt; &lt;c:when test="${deliveryBill[0].vipType eq '6'}"&gt; &lt;font class="redone"&gt;******&lt;/font&gt; &lt;/c:when&gt; &lt;c:when test="${deliveryBill[0].vipType eq '7'}"&gt; &lt;!--img src="&lt;%=request.getContextPath()%&gt;/images/star7.gif"&gt;--&gt; &lt;/c:when&gt; &lt;/c:choose&gt; &lt;/td&gt; &lt;td&gt;${deliveryBill[2]}&lt;/td&gt; &lt;td&gt;&lt;c:forEach var="t" items="${systemType.deliveryType}"&gt; &lt;c:if test="${deliveryBill[0].deliveryType == t.value}"&gt; ${t.label} &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;br&gt; &lt;c:forEach var="t" items="${systemType.taskType}"&gt; &lt;c:if test="${deliveryBill[1] == t.value}"&gt;${t.label}&lt;/c:if&gt; &lt;/c:forEach&gt; &lt;/td&gt; &lt;td&gt;&lt;c:forEach var="deliveryCityID" items="${systemType.areaAddressList}"&gt; &lt;c:if test="${deliveryBill[0].deliveryCityID == deliveryCityID.code}"&gt; ${deliveryCityID.name} &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;br&gt;&lt;c:forEach var="areaItem" items="${systemType.areaAddressList}"&gt; &lt;c:if test="${areaItem.code eq deliveryBill[0].deliveryZoneID &amp;&amp; areaItem.type eq '4' &amp;&amp; areaItem.fatherCode eq deliveryBill[0].deliveryCityID}"&gt; ${areaItem.name} &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;/td&gt; &lt;td title="${deliveryBill[0].deliveryAddress}"&gt; ${fn:substring(deliveryBill[0].deliveryAddress, 0, 12)} &lt;/td&gt; &lt;td&gt;${deliveryBill[0].deliveryDate}&lt;br&gt; ${fn:substring(deliveryBill[0].dsBeginTime, 0, 5)}-${fn:substring(deliveryBill[0].dsEndTime, 0, 5)}&lt;/td&gt; &lt;td&gt;${deliveryBill[3]}&lt;br&gt;${deliveryBill[4]}&lt;/td&gt; &lt;td id="${deliveryBill[0].id}~${deliveryBill[1]}"&gt;&lt;c:choose&gt; &lt;c:when test="${deliveryBill[0].deliveryState == 8 || (deliveryBill[0].deliveryState == 0 &amp;&amp; deliveryBill[0].gatheringState == 8 )}"&gt; 已完成 &lt;/c:when&gt; &lt;c:when test="${deliveryBill[0].deliveryState == 13 || deliveryBill[0].gatheringState == 13}"&gt; 已取消 &lt;/c:when&gt; &lt;c:otherwise&gt; &lt;script type="text/javascript"&gt; getDiffTime('${deliveryBill[0].id}~${deliveryBill[1]}', '${deliveryBill[0].deliveryDate}', '${deliveryBill[0].dsBeginTime}'); &lt;/script&gt; &lt;/c:otherwise&gt; &lt;/c:choose&gt; &lt;/td&gt; &lt;td&gt;&lt;c:forEach var="ds" items="${systemType.deliveryState}"&gt; &lt;c:if test="${deliveryBill[0].deliveryState == ds.value}"&gt;${ds.label}&lt;/c:if&gt; &lt;/c:forEach&gt; &lt;/td&gt; &lt;td&gt;&lt;c:forEach var="ds" items="${systemType.deliveryState}"&gt; &lt;c:if test="${deliveryBill[0].gatheringState == ds.value}"&gt;${ds.label}&lt;/c:if&gt; &lt;/c:forEach&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt; &lt;tr height="30"&gt; &lt;td colspan="15" align="right"&gt;&lt;c:set value="queryform" var="form_name" scope="request" /&gt; &lt;jsp:include page="/jsp/common/page2.jsp" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;%@ include file="/jsp/common/commontail.jsp"%&gt; &lt;/body&gt; &lt;script&gt; init(); &lt;/script&gt; &lt;/html&gt; &lt;script language="javascript"&gt; var liandong=new CLASS_LIANDONG_YAO(array) liandong.firstSelectChange("根目录","deliveryCenter","${params.centerCD}"); liandong.subSelectChange("deliveryCenter","deliveryUnit","${params.deliveryUnitCD}"); &lt;/script&gt; &lt;script type="text/javascript"&gt; var array=new Array(); &lt;c:set scope="page" var="problemTypeBigSize" value="0"/&gt; &lt;c:set scope="page" var="problemTypeSmallSize" value="0"/&gt; &lt;c:forEach var="billProblemBigType" items="${systemType.billProblemTypeList}" &gt; &lt;c:if test="${billProblemBigType.classlevel==1}" &gt; array[&lt;c:out value='${problemTypeBigSize}'/&gt;]=new Array(); array[&lt;c:out value='${problemTypeBigSize}'/&gt;][0]="&lt;c:out value='${billProblemBigType.code}'/&gt;"; array[&lt;c:out value='${problemTypeBigSize}'/&gt;][1]="根目录"; array[&lt;c:out value='${problemTypeBigSize}'/&gt;][2]="&lt;c:out value='${billProblemBigType.questionDepict}'/&gt;"; &lt;c:set scope="page" var="problemTypeBigSize" value="${problemTypeBigSize+1}"/&gt; &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;c:forEach var="billProblemSmallType" items="${systemType.billProblemTypeList}" &gt; &lt;c:if test="${billProblemSmallType.classlevel==2}" &gt; array[&lt;c:out value='${problemTypeSmallSize+problemTypeBigSize}'/&gt;]=new Array(); array[&lt;c:out value='${problemTypeSmallSize+problemTypeBigSize}'/&gt;][0]="&lt;c:out value='${billProblemSmallType.code}'/&gt;"; array[&lt;c:out value='${problemTypeSmallSize+problemTypeBigSize}'/&gt;][1]="&lt;c:out value='${billProblemSmallType.problemType.code}'/&gt;"; array[&lt;c:out value='${problemTypeSmallSize+problemTypeBigSize}'/&gt;][2]="&lt;c:out value='${billProblemSmallType.questionDepict}'/&gt;"; &lt;c:set scope="page" var="problemTypeSmallSize" value="${problemTypeSmallSize+1}"/&gt; &lt;/c:if&gt; &lt;/c:forEach&gt; var liandong=new CLASS_LIANDONG_YAO(array) liandong.firstSelectChange("根目录","billProblemBigType","${params.questionBigCode}"); liandong.subSelectChange("billProblemBigType","billProblemSmallType","${params.questionSmallCode}"); &lt;/script&gt; </pre> <p> </p> <p>感激不尽</p> </div>
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私有的数
win10系统安装教程(U盘PE+UEFI安装)
一、准备工作 u盘,电脑一台,win10原版镜像(msdn官网) 二、下载wepe工具箱  极力推荐微pe(微pe官方下载) 下载64位的win10 pe,使用工具箱制作启动U盘打开软件,   选择安装到U盘(按照操作无需更改) 三、重启进入pe系统   1、关机后,将U盘插入电脑 2、按下电源后,按住F12进入启动项选择(技嘉主板是F12)     选择需要启
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
Nginx 软件层面加强Nginx性能优化的面试问答和解决方案
Nginx 软件层面加强Nginx性能优化的面试问答和解决方案 去年我去爱卡汽车面试PHP,一轮和二轮面的都不错,在三轮面到Nginx的时候很多问题当时不知道怎么回答,确实没有深入学习过,花了一段时间的学习,终于能解答Nginx高性能优化的问题了,10月24号为了获得程序员勋章,发布了半个优化笔记,浏览到了1000+,受到这个鼓舞,我抽时间在仔细整理下关于Nginx性能优化的问题,我们从软件说起。...
【管理系统课程设计】美少女手把手教你后台管理
【文章后台管理系统】URL设计与建模分析+项目源码+运行界面 栏目管理、文章列表、用户管理、角色管理、权限管理模块(文章最后附有源码) 1. 这是一个什么系统? 1.1 学习后台管理系统的原因 随着时代的变迁,现如今各大云服务平台横空出世,市面上有许多如学生信息系统、图书阅读系统、停车场管理系统等的管理系统,而本人家里就有人在用烟草销售系统,直接在网上完成挑选、购买与提交收货点,方便又快捷。 试想,若没有烟草销售系统,本人家人想要购买烟草,还要独自前往药...
11月19日科技资讯|华为明日发布鸿蒙整体战略;京东宣告全面向技术转型;Kotlin 1.3.60 发布
「极客头条」—— 技术人员的新闻圈! CSDN 的读者朋友们早上好哇,「极客头条」来啦,快来看今天都有哪些值得我们技术人关注的重要新闻吧。扫描上方二维码进入 CSDN App 可以收听御姐萌妹 Style 的人工版音频哟。 一分钟速览新闻点! 6G 专家组成员:速率是 5G 的 10 至 100 倍,预计 2030 年商用 雷军:很多人多次劝我放弃WPS,能坚持下来并不是纯粹的商业决定 ...
C语言魔塔游戏
很早就很想写这个,今天终于写完了。 游戏截图: 编译环境: VS2017 游戏需要一些图片,如果有想要的或者对游戏有什么看法的可以加我的QQ 2985486630 讨论,如果暂时没有回应,可以在博客下方留言,到时候我会看到。 下面我来介绍一下游戏的主要功能和实现方式 首先是玩家的定义,使用结构体,这个名字是可以自己改变的 struct gamerole { char n
化繁为简 - 腾讯计费高一致TDXA的实践之路
导语:腾讯计费是孵化于支撑腾讯内部业务千亿级营收的互联网计费平台,在如此庞大的业务体量下,腾讯计费要支撑业务的快速增长,同时还要保证每笔交易不错账。采用最终一致性或离线补...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip install selenium -i https://pypi.tuna.tsinghua.edu.cn/simple/ 
Java学习笔记(七十二)—— Cookie
概述 会话技术: 会话:一次会话中包含多次请求和响应 一次会话:浏览器第一次给服务器发送资源请求,会话建立,直到有一方断开为止 功能:在一次会话的范围内的多次请求间,共享数据 方式: 客户端会话技术:Cookie,把数据存储到客户端 服务器端会话技术:Session,把数据存储到服务器端 Cookie 概念:客户端会话技术,将数据存储到客户端 快速入门: 使用步骤: 创建C
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆  每天早上8:30推送 作者| Mr.K   编辑| Emma 来源| 技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯
程序员该看的几部电影
##1、骇客帝国(1999) 概念:在线/离线,递归,循环,矩阵等 剧情简介: 不久的将来,网络黑客尼奥对这个看似正常的现实世界产生了怀疑。 他结识了黑客崔妮蒂,并见到了黑客组织的首领墨菲斯。 墨菲斯告诉他,现实世界其实是由一个名叫“母体”的计算机人工智能系统控制,人们就像他们饲养的动物,没有自由和思想,而尼奥就是能够拯救人类的救世主。 可是,救赎之路从来都不会一帆风顺,到底哪里才是真实的世界?
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东
@程序员,如何花式构建线程?
作者 |曾建责编 | 郭芮出品 | CSDN(ID:CSDNnews)在项目和业务的开发中,我们难免要经常使用线程来进行业务处理,使用线程可以保证我们的业务在相互处理之间可以保证原子性...
破14亿,Python分析我国存在哪些人口危机!
2020年1月17日,国家统计局发布了2019年国民经济报告,报告中指出我国人口突破14亿。 猪哥的朋友圈被14亿人口刷屏,但是很多人并没有看到我国复杂的人口问题:老龄化、男女比例失衡、生育率下降、人口红利下降等。 今天我们就来分析一下我们国家的人口数据吧! 一、背景 1.人口突破14亿 2020年1月17日,国家统计局发布了 2019年国民经济报告 ,报告中指出:年末中国大陆总人口(包括31个
强烈推荐10本程序员在家读的书
很遗憾,这个鼠年春节注定是刻骨铭心的,新型冠状病毒让每个人的神经都是紧绷的。那些处在武汉的白衣天使们,尤其值得我们的尊敬。而我们这些窝在家里的程序员,能不外出就不外出,就是对社会做出的最大的贡献。 有些读者私下问我,窝了几天,有点颓丧,能否推荐几本书在家里看看。我花了一天的时间,挑选了 10 本我最喜欢的书,你可以挑选感兴趣的来读一读。读书不仅可以平复恐惧的压力,还可以对未来充满希望,毕竟苦难终
Linux自学篇——linux命令英文全称及解释
man: Manual 意思是手册,可以用这个命令查询其他命令的用法。 pwd:Print working directory 显示当前目录 su:Swith user 切换用户,切换到root用户 cd:Change directory 切换目录 ls:List files 列出目录下的文件 ps:Process Status 进程状态 mk
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
文章目录1. 前言2. 数据下载3. 数据处理4. 数据可视化 1. 前言 今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。 2月6日追记:本文发布后,腾讯的数据源多次变更u
智力题(程序员面试经典)
NO.1  有20瓶药丸,其中19瓶装有1克/粒的药丸,余下一瓶装有1.1克/粒的药丸。给你一台称重精准的天平,怎么找出比较重的那瓶药丸?天平只能用一次。 解法 有时候,严格的限制条件有可能反倒是解题的线索。在这个问题中,限制条件是天平只能用一次。 因为天平只能用一次,我们也得以知道一个有趣的事实:一次必须同时称很多药丸,其实更准确地说,是必须从19瓶拿出药丸进行称重。否则,如果跳过两瓶或更多瓶药
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ......
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!
2020年的1月,我辞掉了我的第一份工作
其实,这篇文章,我应该早点写的,毕竟现在已经2月份了。不过一些其它原因,或者是我的惰性、还有一些迷茫的念头,让自己迟迟没有试着写一点东西,记录下,或者说是总结下自己前3年的工作上的经历、学习的过程。 我自己知道的,在写自己的博客方面,我的文笔很一般,非技术类的文章不想去写;另外我又是一个还比较热衷于技术的人,而平常复杂一点的东西,如果想写文章写的清楚点,是需要足够...
别低估自己的直觉,也别高估自己的智商
所有群全部吵翻天,朋友圈全部沦陷,公众号疯狂转发。这两周没怎么发原创,只发新闻,可能有人注意到了。我不是懒,是文章写了却没发,因为大家的关注力始终在这次的疫情上面,发了也没人看。当然,我...
Java坑人面试题系列: 包装类(中级难度)
Java Magazine上面有一个专门坑人的面试题系列: https://blogs.oracle.com/javamagazine/quiz-2。 这些问题的设计宗旨,主要是测试面试者对Java语言的了解程度,而不是为了用弯弯绕绕的手段把面试者搞蒙。 如果你看过往期的问题,就会发现每一个都不简单。 这些试题模拟了认证考试中的一些难题。 而 “中级(intermediate)” 和 “高级(ad
Spring Boot 2.x基础教程:使用JdbcTemplate访问MySQL数据库
在第2章节中,我们介绍了如何通过Spring Boot来实现HTTP接口,以及围绕HTTP接口相关的单元测试、文档生成等实用技能。但是,这些内容还不足以帮助我们构建一个动态应用的服务端程序。不论我们是要做App、小程序、还是传统的Web站点,对于用户的信息、相关业务的内容,通常都需要对其进行存储,而不是像第2章节中那样,把用户信息存储在内存中(重启就丢了!)。 对于信息的存储,现在已经有非常非常多...
基于Python的人脸自动戴口罩系统
目录 1、项目背景 2、页面设计 3、器官识别 4、退出系统 1、项目背景 2019年新型冠状病毒感染的肺炎疫情发生以来,牵动人心,举国哀痛,口罩、酒精、消毒液奇货可居。 抢不到口罩,怎么办?作为技术人今天分享如何使用Python实现自动戴口罩系统,来安慰自己,系统效果如下所示: 本系统的实现原理是借助 Dlib模块的Landmark人脸68个关键点检测库轻松识别出人脸五官
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。 再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。 下文是原回答,希望能对你能有所启发。 如果我说,这个世界上人真的分三六九等,...
相关热词 c# 识别回车 c#生成条形码ean13 c#子控制器调用父控制器 c# 写大文件 c# 浏览pdf c#获取桌面图标的句柄 c# list反射 c# 句柄 进程 c# 倒计时 线程 c# 窗体背景色
立即提问