如上我都不知道怎么办了,该看什么地方的设置吗?代码应该是没有错的,就只是换了一个服务器而已在JAVA里打印的信息是:
insert into temp_wi_u_contactor ( vc_name, vc_mobile, vc_phone1, vc_phone2, fax,vc_email,address1,address2,vc_desc) values ('譳蝥?', 1234, '', '', '', '', '', '', '')
vc_name 为乱码了。JXL读取XLS文件的函数如下: public static JxlReportModel readExcelXLS(String filename)
{
Workbook workbook = null;
try {
// 打开文件
workbook = Workbook.getWorkbook(new File(filename));
// 打开工作表
Sheet sheet = workbook.getSheet(0); Cell cell = null;
int irow = 0;
int icol = 0; int nRows = sheet.getRows();
int nCols = sheet.getColumns();
String[][] cellData = new String[nRows][nCols];
for (irow = 0; irow < nRows; irow ++) {
for (icol = 0; icol < nCols; icol ++) {
// 注意,第一个参数是表示列的,第二个参数才表示行
cell = sheet.getCell(icol, irow); // 要根据单元格的类型分别做处理,否则格式化的内容会不正确 if (cell.getType() == CellType.NUMBER) { //直接读取 Number 类型
cellData[irow][icol] = cell.getContents(); //以科学计数法表示 Number 类型
// cellData[irow][icol] = String.valueOf((
// (NumberCell)cell).getValue()); } else if (cell.getType() == CellType.DATE) { cellData[irow][icol] = String.valueOf((
(DateCell)cell).getDate());
} else { cellData[irow][icol] = cell.getContents(); // 就是这个出了乱码
} // end if } // end cols
} // end rows // 返回
JxlReportModel model = new JxlReportModel();
model.setDataCols(nCols);
model.setDataRows(nRows);
model.setCells(cellData); return model;
} catch (Exception ex) {
ex.printStackTrace();
return null;
} finally {
// 一定要关闭,否则有内存空洞存在
if (workbook != null) {
workbook.close();
} }
}
insert into temp_wi_u_contactor ( vc_name, vc_mobile, vc_phone1, vc_phone2, fax,vc_email,address1,address2,vc_desc) values ('譳蝥?', 1234, '', '', '', '', '', '', '')
vc_name 为乱码了。JXL读取XLS文件的函数如下: public static JxlReportModel readExcelXLS(String filename)
{
Workbook workbook = null;
try {
// 打开文件
workbook = Workbook.getWorkbook(new File(filename));
// 打开工作表
Sheet sheet = workbook.getSheet(0); Cell cell = null;
int irow = 0;
int icol = 0; int nRows = sheet.getRows();
int nCols = sheet.getColumns();
String[][] cellData = new String[nRows][nCols];
for (irow = 0; irow < nRows; irow ++) {
for (icol = 0; icol < nCols; icol ++) {
// 注意,第一个参数是表示列的,第二个参数才表示行
cell = sheet.getCell(icol, irow); // 要根据单元格的类型分别做处理,否则格式化的内容会不正确 if (cell.getType() == CellType.NUMBER) { //直接读取 Number 类型
cellData[irow][icol] = cell.getContents(); //以科学计数法表示 Number 类型
// cellData[irow][icol] = String.valueOf((
// (NumberCell)cell).getValue()); } else if (cell.getType() == CellType.DATE) { cellData[irow][icol] = String.valueOf((
(DateCell)cell).getDate());
} else { cellData[irow][icol] = cell.getContents(); // 就是这个出了乱码
} // end if } // end cols
} // end rows // 返回
JxlReportModel model = new JxlReportModel();
model.setDataCols(nCols);
model.setDataRows(nRows);
model.setCells(cellData); return model;
} catch (Exception ex) {
ex.printStackTrace();
return null;
} finally {
// 一定要关闭,否则有内存空洞存在
if (workbook != null) {
workbook.close();
} }
}
解决方案 »
- The requested resource (Servlet action is not available) is not available.
- 我想问个关于套接字编程的问题,刚接触请大侠们指教
- struts 中当前也面提交后,如果刷新对应iframe下面的值?
- dwr整合spring时出现了问题 大家进来帮半个忙
- 请教高手-连接池
- 关于在jsp页面中“include“servlet的问题
- 以域名会友,希望认识长沙的同行!!!
- 怎么把JPG或JIF的图片写到数据库中去?如果字段只存一个路径名,又怎么找到图片?
- 【求教】利用JSP生成XML文档
- java注释影响效率吗
- 搞了好长时间,谁来终结一下
- PK网站时间同步问题:设置天数,如何实现到期自动将其相应分数给赢者,担心的是本地时间不准确。应该如何处理时间问题?!
JXL读出来的却是:譳蝥?