2020-06-04 17:20

@JFinal 相信很多人都是从 springMVC 过来的,为什么这个路由不模仿springMVC的方式,同时也支持现有方式,照顾一下强迫症者(我也是搞题主的模式的)

2020-04-21 17:41

可能是平台的XSS拦截过滤了泛型字符串

2020-04-21 17:40

代码里的泛型被过滤掉了

2020-04-21 17:38

我习惯性的操作如下:
File file = getFile().getFile();
ExcelReader er = new ExcelReader(file, "Sheet1");
List> list = er.getSheetData();








import org.apache.poi.ss.usermodel.*;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;


public class ExcelReader {
private File file;
private String sheetName;
private Sheet sheet;
private List> listData = null;


public ExcelReader(String filePath, String sheetName) {
this.file = new File(filePath);
this.sheetName = sheetName;
this.load();
}

public ExcelReader(File file, String sheetName) {
this.file = file;
this.sheetName = sheetName;
this.load();
}


private void load() {
FileInputStream inStream = null;
try {
inStream = new FileInputStream(file);
Workbook workBook = WorkbookFactory.create(inStream);
sheet = workBook.getSheet(sheetName);
dealSheetData();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (inStream != null) {
inStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}

private void dealSheetData() {
listData = new ArrayList<>();

int length = sheet.getLastRowNum() + 1;
for (int i = 0; i < length; i++) {
Row row = sheet.getRow(i);

List list = new ArrayList<>();
if (row != null) {
for (int j = 0; j < row.getLastCellNum(); j++) {
Cell cell = row.getCell(j);

list.add(getCellValue(cell));
}
}
listData.add(list);
}
}


private String getCellValue(Cell cell) {
String cellValue = "";
if (cell != null) {
switch (cell.getCellTypeEnum()) {
case NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
DataFormatter formatter = new DataFormatter();
cellValue = formatter.formatCellValue(cell);
} else {
double value = cell.getNumericCellValue();
int intValue = (int) value;
cellValue = value - intValue == 0 ? String.valueOf(intValue) : String.valueOf(value);
}
break;
case STRING:
cellValue = cell.getStringCellValue();
break;
case BOOLEAN:
cellValue = String.valueOf(cell.getBooleanCellValue());
break;
case FORMULA:
cellValue = String.valueOf(cell.getCellFormula());
break;
case BLANK:
cellValue = "";
break;
case ERROR:
cellValue = "";
break;
default:
cellValue = cell.toString().trim();
break;
}
}
return cellValue.trim();
}

public List> getSheetData() {
return listData;
}

public String getCellData(int row, int col) {
if (row <= 0 || col <= 0) return null;

if (listData.size() >= row && listData.get(row - 1).size() >= col) {
return listData.get(row - 1).get(col - 1);
}
return null;
}


public static void main(String[] args) {
ExcelReader eh = new ExcelReader("C:\\Users\\lzy\\Desktop\\工作簿1.xls", "Sheet1");
System.out.println(eh.getCellData(1, 1));
// System.out.println(eh.getCellData(1, "test1"));
System.out.println(eh.getCellData(1, 2));
System.out.println(eh.getSheetData());
}

}

2020-04-02 15:54

我有碰到类似情况,我是这么解决的:
setAttr("listB", JsonKit.toJson(listB));

var listB = JSON.parse('#(listB)'); //这里要 try catch 一下,你的listB可能为空

2019-11-15 09:28

https://www.jfinal.com/doc/3-11

2019-11-15 09:28

文档3.11节:
特别注意:如果客户端请求为multipart request(form表单使用了enctype="multipart/form-data"),那么必须先调用getFile系列方法才能使getPara系列方法正常工作,因为multipart request需要通过getFile系列方法解析请求体中的数据,包括参数。同样的道理在Interceptor、Validator中也需要先调用getFile

2019-08-21 11:59

#define common()
...大量查询条件
#end

#sql("xxx")
select * from xxx where 1=1
#@common()
#end

#sql("ooo")
select * from xxx where 1=1
#@common()
#end

PS:问问题前先看文档学习先,否则也就我这么无聊才回答你这个谁都知道但又懒得回答的问题

2019-07-27 19:02

再加上 getSession().invalidate(); 试试

2019-03-02 11:22

@JFinal 好的,谢谢博主

2018-12-29 18:16

@JFinal 网主,sql写一点还是可以的,但是写多了,感觉全是 #sql #end ####...,看得眼花缭乱,都不知道那个块跟那个块了