java poi excel 咋么让地址是用户自定义的

@RequestMapping(value="/poii")
public String nnn(HttpServletResponse response1) throws Exception {
HttpServletResponse response=new HttpServletResponseWrapper(response1);
ApplicationContext ac = new ClassPathXmlApplicationContext(
"applicationContext.xml");

    ProductServiceIn bean = ac.getBean("ProductService",
            ProductServiceIn.class);
    List<Map<String, Object>> list = bean.selectProduct();

    response.addHeader("Content-Dispositio","attachment;filename="+"name");
    Workbook wb = new HSSFWorkbook();

    Sheet sheet = wb.createSheet("product");
    for (int i = 0; i < list.size(); i++) {
        Row row = sheet.createRow(i);
        Map<String, Object> map = list.get(i);
        Set<String> set = map.keySet();
        Iterator<String> key = set.iterator();
        int j = 0;
        while (key.hasNext()) {
            String str = key.next();
            Cell cell = row.createCell(j);
            cell.setCellValue(map.get(str).toString());
            j++;
        }

    }

    wb.write(new FileOutputStream(""));
    return "test";
}

1个回答

提供一个输入框,提示用户输入有效地址就行了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问