主题:请高手们帮个忙吧!
我想做个信息管理系统,现在查询做好了,但不知如何实现导出到EXCEL表,打印等功能,请各位高手多多帮助我这个初学者!谢谢,系统是在RESIN+ORACLE9I下做的,下面是我的查询源代码,后面该怎么做下去呢,请尽量详细点,谢谢,我的邮箱是xzw_cn@163.com
[search.jsp]
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<link rel="stylesheet" href="public.css">
<SCRIPT LANGUAGE=javascript>
function button2_onclick()
{ // 字段不能都为空,如果发布日期为空,则查询条件不能空
if (form1.searchcontent.value == "")
{
alert("查询条件不能都为空!");
form1.searchcontent.focus();
return (false);
}
}
</SCRIPT>
</head>
<body>
<form name="form1" method="POST" action="searchlist.jsp">
<center>
<table border="0" width="80%">
<br>
<tr><td align=center><font color="#7966C6" size="3"><strong>企业档案查询</font></strong></TD></TR>
<tr><td align="center">
<p><br><br><font color="#000080">查询范围:</font>
<select name="D1" >
<option value="qyname">企业名称</option>
<option selected value="qysh">企业税号</option>
</select>
<font color="#000080"> 查询内容:</font> <font color="#000080">
<input type="text" name="searchcontent" size="25"></font></p></td>
<tr><td height="50" align="middle">
<div align="center">
<p><br><br> <input type="submit" value=" 查询 " language=javascript name="tijiao" onclick="return button2_onclick()">
<input type="reset" value=" 重置 " name="cancel">
</div></td></P></tr></table></center></form></body></html>
[searchlist.jsp]
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.io.*,java.text.*,java.util.Date,java.util.*,java.math.*,java.sql.*,java.net.*,java.lang.*,comm.*"%>
<%! String strSQL="",fwSQL="",searchcontent1,searchfanwei,searchcontent; %>
<html>
<head>
<link rel="stylesheet" href="public.css">
</head>
<body>
<br>
<center>
<form name="form1" method="POST" action="????.jsp">
<table border="0" width="95%">
<tr><FONT color=#ffffff><B> 查询结果</FONT></b>
<% try{
// 取得查询关键则
searchcontent1 = request.getParameter("searchcontent");
searchcontent = "%" + searchcontent1 + "%";
// 取得查询字段值
searchfanwei = request.getParameter("D1");
if(searchfanwei.equals("qysh"))
strSQL = " qysh like'"+searchcontent+"' order by qysh desc";
else if(searchfanwei.equals("qyname"))
strSQL =" qyname like'"+searchcontent+"' order by qysh desc";
strSQL = " where " + strSQL;
// 定义数组对象接受查询的记录信息
ArrayList schList = new ArrayList();
// 定义字符串数组
String sInfo[] = new String[4];
QYinfo o_Info = new QYinfo();
schList = o_Info.getSearchResult(strSQL);
int iQyCnt=schList.size();
if(schList.size()==0)
out.println("<td align=center colspan=9><font color=red>未能找到,请重新查询!</font></td>");
else
{ out.println("<td align=center><font color=red>总"+iQyCnt+"条</font></td>");%>
<table width=98% align="center" cellspacing=1 cellpadding=2 border=1 bordercolor=#808080 bordercolordark=#FFFFFF style=font-size: 9pt; font-family: 宋体 bordercolorlight=#DAC1E1>
<br><tr>
<td align=center width=6% bgcolor=#C9E9FA>序号</td>
<td align=center width=30% bgcolor=#C9E9FA>企业名称</td>
<td align=center width=12% bgcolor=#C9E9FA>企业税号</td>
<td align=center width=30% bgcolor=#C9E9FA>企业地址</td>
<td align=center width=12% bgcolor=#C9E9FA>联系电话</td>
<td align=center width=10% bgcolor=#C9E9FA>联系人</td>
</tr>
<% for(int j=0;j<schList.size();j++)
{
sInfo = (String[])schList.get(j);
out.println("<td align=middle><font color=blue>"+(j+1)+"</font></td>");
out.println("<td align=left><font size=2>"+sInfo[0]+"</td>");
out.println("<td align=middle><font size=2>"+sInfo[1]+"</td>");
out.println("<td align=left><font size=2>"+sInfo[2]+"</td>");
out.println("<td align=middle><font size=2>"+sInfo[3]+"</td>");
out.println("<td align=middle><font size=2>"+sInfo[4]+"</td></tr>");
}
}
}
catch(Exception e)
{throw new Exception(e.getMessage());}
%>
</td></tr>
</table>
<p><p><input type="submit" value=" 导出 " name="daochu">
<input type="submit" value=" 打印预览 " name="dyyl">
<input type="submit" value=" 打印 " name="dayin">
</center>
</body>
</html>
请帮忙完成!谢谢(高分)
[search.jsp]
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<link rel="stylesheet" href="public.css">
<SCRIPT LANGUAGE=javascript>
function button2_onclick()
{ // 字段不能都为空,如果发布日期为空,则查询条件不能空
if (form1.searchcontent.value == "")
{
alert("查询条件不能都为空!");
form1.searchcontent.focus();
return (false);
}
}
</SCRIPT>
</head>
<body>
<form name="form1" method="POST" action="searchlist.jsp">
<center>
<table border="0" width="80%">
<br>
<tr><td align=center><font color="#7966C6" size="3"><strong>企业档案查询</font></strong></TD></TR>
<tr><td align="center">
<p><br><br><font color="#000080">查询范围:</font>
<select name="D1" >
<option value="qyname">企业名称</option>
<option selected value="qysh">企业税号</option>
</select>
<font color="#000080"> 查询内容:</font> <font color="#000080">
<input type="text" name="searchcontent" size="25"></font></p></td>
<tr><td height="50" align="middle">
<div align="center">
<p><br><br> <input type="submit" value=" 查询 " language=javascript name="tijiao" onclick="return button2_onclick()">
<input type="reset" value=" 重置 " name="cancel">
</div></td></P></tr></table></center></form></body></html>
[searchlist.jsp]
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.io.*,java.text.*,java.util.Date,java.util.*,java.math.*,java.sql.*,java.net.*,java.lang.*,comm.*"%>
<%! String strSQL="",fwSQL="",searchcontent1,searchfanwei,searchcontent; %>
<html>
<head>
<link rel="stylesheet" href="public.css">
</head>
<body>
<br>
<center>
<form name="form1" method="POST" action="????.jsp">
<table border="0" width="95%">
<tr><FONT color=#ffffff><B> 查询结果</FONT></b>
<% try{
// 取得查询关键则
searchcontent1 = request.getParameter("searchcontent");
searchcontent = "%" + searchcontent1 + "%";
// 取得查询字段值
searchfanwei = request.getParameter("D1");
if(searchfanwei.equals("qysh"))
strSQL = " qysh like'"+searchcontent+"' order by qysh desc";
else if(searchfanwei.equals("qyname"))
strSQL =" qyname like'"+searchcontent+"' order by qysh desc";
strSQL = " where " + strSQL;
// 定义数组对象接受查询的记录信息
ArrayList schList = new ArrayList();
// 定义字符串数组
String sInfo[] = new String[4];
QYinfo o_Info = new QYinfo();
schList = o_Info.getSearchResult(strSQL);
int iQyCnt=schList.size();
if(schList.size()==0)
out.println("<td align=center colspan=9><font color=red>未能找到,请重新查询!</font></td>");
else
{ out.println("<td align=center><font color=red>总"+iQyCnt+"条</font></td>");%>
<table width=98% align="center" cellspacing=1 cellpadding=2 border=1 bordercolor=#808080 bordercolordark=#FFFFFF style=font-size: 9pt; font-family: 宋体 bordercolorlight=#DAC1E1>
<br><tr>
<td align=center width=6% bgcolor=#C9E9FA>序号</td>
<td align=center width=30% bgcolor=#C9E9FA>企业名称</td>
<td align=center width=12% bgcolor=#C9E9FA>企业税号</td>
<td align=center width=30% bgcolor=#C9E9FA>企业地址</td>
<td align=center width=12% bgcolor=#C9E9FA>联系电话</td>
<td align=center width=10% bgcolor=#C9E9FA>联系人</td>
</tr>
<% for(int j=0;j<schList.size();j++)
{
sInfo = (String[])schList.get(j);
out.println("<td align=middle><font color=blue>"+(j+1)+"</font></td>");
out.println("<td align=left><font size=2>"+sInfo[0]+"</td>");
out.println("<td align=middle><font size=2>"+sInfo[1]+"</td>");
out.println("<td align=left><font size=2>"+sInfo[2]+"</td>");
out.println("<td align=middle><font size=2>"+sInfo[3]+"</td>");
out.println("<td align=middle><font size=2>"+sInfo[4]+"</td></tr>");
}
}
}
catch(Exception e)
{throw new Exception(e.getMessage());}
%>
</td></tr>
</table>
<p><p><input type="submit" value=" 导出 " name="daochu">
<input type="submit" value=" 打印预览 " name="dyyl">
<input type="submit" value=" 打印 " name="dayin">
</center>
</body>
</html>
请帮忙完成!谢谢(高分)