您的位置:首页 > 其它

HP Server系统安装

2010-05-09 19:35 405 查看
<%@pagecontentType="text/html;charset=GBK"errorPage="/error.jsp"%>

<jsp:useBeanid="idmServer"scope="application"class="com.***.idm.IdentityServer"/>

<%--//checks.jsp包括登录校验、idmServer/loginUrl/checkUserName变量声明、服务器是否启动、登录用户是否有超级管理员权限--%>

<%@pageimport="java.util.List"%>

<%@pageimport="com.***.idm.model.service.UIService"%>

<%@pageimport="com.***.idm.data.bo.User"%>

<%@pageimport="org.apache.poi.hssf.usermodel.*"%>

<%@pageimport="com.***.idm.data.service.SearchFilter"%>

<%@pageimport="java.io.*"%>

<%@pageimport="java.util.Date"%>

<%

String_total=request.getParameter("total");//取得记录总数

intint_total=Integer.parseInt(_total);

try{

HSSFWorkbookhssfworkbook=newHSSFWorkbook();

HSSFSheethssfsheet=hssfworkbook.createSheet();//创建sheet页

hssfworkbook.setSheetName(0,"用户列表",HSSFWorkbook.ENCODING_UTF_16);//sheet名称乱码处理

HSSFRowhssfrow=hssfsheet.createRow(0);//创建表头

HSSFCellhssfcell_title_0=hssfrow.createCell((short)0);//创建第一个单元格

hssfcell_title_0.setEncoding(HSSFWorkbook.ENCODING_UTF_16);//处理乱码

hssfcell_title_0.setCellValue("用户名");//对第一个单元格赋值

HSSFCellhssfcell_title_1=hssfrow.createCell((short)1);//创建第二个单元格子

hssfcell_title_1.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_title_1.setCellValue("昵称");

HSSFCellhssfcell_title_2=hssfrow.createCell((short)2);

hssfcell_title_2.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_title_2.setCellValue("真名");

HSSFCellhssfcell_title_3=hssfrow.createCell((short)3);

hssfcell_title_3.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_title_3.setCellValue("电子邮件");

HSSFCellhssfcell_title_4=hssfrow.createCell((short)4);

hssfcell_title_4.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_title_4.setCellValue("身份证号");

HSSFCellhssfcell_title_5=hssfrow.createCell((short)5);

hssfcell_title_5.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_title_5.setCellValue("所属组织");

HSSFCellhssfcell_title_6=hssfrow.createCell((short)6);

hssfcell_title_6.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_title_6.setCellValue("是否开通");

HSSFCellhssfcell_title_7=hssfrow.createCell((short)7);

hssfcell_title_7.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_title_7.setCellValue("电话");

HSSFCellhssfcell_title_8=hssfrow.createCell((short)8);

hssfcell_title_8.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_title_8.setCellValue("手机");

HSSFCellhssfcell_title_9=hssfrow.createCell((short)9);

hssfcell_title_9.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_title_9.setCellValue("说明");

booleancdn=false;

SearchFiltersf=newSearchFilter();

if(true){

sf.addCondition("''","''","''");//查询条件(全部查出)

cdn=true;

}

Listusers=null;

if(cdn==true){

try{

users=idmServer.getModelService().getUserManager().findByFilter(sf);//取得全部记录

}catch(Exceptione){

e.printStackTrace();

}

}

System.out.println("已导出数据"+users.size()+"条!");

//if(users!=null&&users.size()>0){

//out.print("true");

//}else{

//out.print("false");

//}

for(inti=1;i<=int_total;i++){

Useruser=(User)users.get(i-1);

//创建sheet新行

HSSFRowhssfrow_Name=hssfsheet.createRow(i);

//依次创建单元格,写入数据

HSSFCellhssfcell_0=hssfrow_Name.createCell((short)0);

hssfcell_0.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_0.setCellValue(user.getUserName());

HSSFCellhssfcell_1=hssfrow_Name.createCell((short)1);

hssfcell_1.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_1.setCellValue(user.getNickName());

HSSFCellhssfcell_2=hssfrow_Name.createCell((short)2);

hssfcell_2.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_2.setCellValue(user.getTrueName());

HSSFCellhssfcell_3=hssfrow_Name.createCell((short)3);

hssfcell_3.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_3.setCellValue(user.getEmail());

HSSFCellhssfcell_4=hssfrow_Name.createCell((short)4);

hssfcell_4.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_4.setCellValue(user.getCreditID());

HSSFCellhssfcell_5=hssfrow_Name.createCell((short)5);

hssfcell_5.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_5.setCellValue(user.getGroupName());

HSSFCellhssfcell_6=hssfrow_Name.createCell((short)6);

hssfcell_6.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_6.setCellValue(user.isActived());

HSSFCellhssfcell_7=hssfrow_Name.createCell((short)7);

hssfcell_7.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_7.setCellValue(user.getTel());

HSSFCellhssfcell_8=hssfrow_Name.createCell((short)8);

hssfcell_8.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_8.setCellValue(user.getMobile());

HSSFCellhssfcell_9=hssfrow_Name.createCell((short)9);

hssfcell_9.setEncoding(HSSFWorkbook.ENCODING_UTF_16);

hssfcell_9.setCellValue(user.getDesc());

}

//HSSFCellStylehssfcellstyle=hssfworkbook.createCellStyle();//日期单元格格式处理

//hssfcellstyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy"));//m/d/yyh:mm

FileOutputStreamfileoutputstream=newFileOutputStream("D:\\用户数据\\用户列表.xls");

hssfworkbook.write(fileoutputstream);

fileoutputstream.close();

}catch(IOExceptione){

e.printStackTrace();

}catch(Exceptione){

e.printStackTrace();

}

%>

<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN">

<html>

<head>

<title>***身份服务器***IDS</title>

<linkhref="../style/style.css"type="text/css"rel=stylesheet>

<linkhref="../style/listStyle.css"type="text/css"rel=stylesheet>

<styletype=text/css>body{

margin:5px

}

</style>

<metahttp-equiv="pragma"content="no-cache">

<metahttp-equiv="cache-control"content="no-cache">

<metahttp-equiv="expires"content="0">

<metahttp-equiv="keywords"content="keyword1,keyword2,keyword3">

<metahttp-equiv="description"content="Thisismypage">

<!--

<linkrel="stylesheet"type="text/css"href="styles.css">

-->

</head>

<body>

<br>

数据已全部导出!<br>

存放路径:D:\用户数据\用户列表.xls<br>

<inputtype="button"value="返回"onClick="history.go(-1);">

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: