我是JSP菜鸟,请教一下:我想实现查询结果在当前的页面显示,就目前实现了在另一个页面显示, 5
privatevoidprintRow1(PrintWriterout)throwsIOException{out.println("<tablewidth=\"1024...
private void printRow1(PrintWriter out) throws IOException {
out.println("<table width=\"1024\" border=\"1\" cellspacing='0' cellpadding='0' align=\"center\" > ");
out.println("<tr height='25' border=\"1\"><td bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><div align='center'><font face='宋体' size='3'><p align='center'>序号</font></div></td>");
out.println("<td bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><div align='center'><font face='宋体' size='3'>姓名</div></td>");
out.println("<td bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><div align='center'><font face='宋体' size='3'>部门</font></div></td>");
out.println("<td bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><div align='center'><font face='宋体' size='3'>岗位</font></div></td>");
out.println("<td bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><div align='center'><font face='宋体' size='3'>办公电话</font></div></td>");
out.println("<td bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><div align='center'><font face='宋体' size='3'>移动电话</font></div></td>");
out.println("<td bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><div align='center'><font face='宋体' size='3'>Email</font></div></td><tr>");
}
private void printRow2(PrintWriter out, ResultSet rs,int i) throws SQLException {
out.println("<tr height='25' bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><td>"+"<div align='center'>"+"<font face='宋体' size='3'>"+i+"</font></div></td>");
out.println("<td>" +"<div align='center'>"+"<font face='宋体' size='3'>" + rs.getString("name") + "</font></div></td>");
out.println("<td>"+"<div align='center'>"+"<font face='宋体' size='3'>" +rs.getString("department")+"</font></div></td>");
out.println("<td>" +"<div align='center'>"+"<font face='宋体' size='3'>" + rs.getString("post") + "</font></div></td>");
out.println("<td>" +"<div align='center'>" +"<font face='宋体' size='3'>"+ rs.getString("ophone") + "</font></div></td>");
out.println("<td>" +"<div align='center'>" +"<font face='宋体' size='3'>"+ rs.getString("mobile") + "</font></div></div></td>");
out.println("<td>" +"<div align='center'>" +"<font face='宋体' size='3'>"+ rs.getString("email") + "</font></div></td><tr>"); 展开
out.println("<table width=\"1024\" border=\"1\" cellspacing='0' cellpadding='0' align=\"center\" > ");
out.println("<tr height='25' border=\"1\"><td bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><div align='center'><font face='宋体' size='3'><p align='center'>序号</font></div></td>");
out.println("<td bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><div align='center'><font face='宋体' size='3'>姓名</div></td>");
out.println("<td bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><div align='center'><font face='宋体' size='3'>部门</font></div></td>");
out.println("<td bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><div align='center'><font face='宋体' size='3'>岗位</font></div></td>");
out.println("<td bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><div align='center'><font face='宋体' size='3'>办公电话</font></div></td>");
out.println("<td bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><div align='center'><font face='宋体' size='3'>移动电话</font></div></td>");
out.println("<td bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><div align='center'><font face='宋体' size='3'>Email</font></div></td><tr>");
}
private void printRow2(PrintWriter out, ResultSet rs,int i) throws SQLException {
out.println("<tr height='25' bgcolor='#FFFFFD' align='left' bordercolor='#CCCCCC'><td>"+"<div align='center'>"+"<font face='宋体' size='3'>"+i+"</font></div></td>");
out.println("<td>" +"<div align='center'>"+"<font face='宋体' size='3'>" + rs.getString("name") + "</font></div></td>");
out.println("<td>"+"<div align='center'>"+"<font face='宋体' size='3'>" +rs.getString("department")+"</font></div></td>");
out.println("<td>" +"<div align='center'>"+"<font face='宋体' size='3'>" + rs.getString("post") + "</font></div></td>");
out.println("<td>" +"<div align='center'>" +"<font face='宋体' size='3'>"+ rs.getString("ophone") + "</font></div></td>");
out.println("<td>" +"<div align='center'>" +"<font face='宋体' size='3'>"+ rs.getString("mobile") + "</font></div></div></td>");
out.println("<td>" +"<div align='center'>" +"<font face='宋体' size='3'>"+ rs.getString("email") + "</font></div></td><tr>"); 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询