Jsp
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<%@ page import="com.DB.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>按姓氏查找结果</title>
<script language="JavaScript">
function moving(){
document.form.submit();
}
</script>
</head>
<body>
<center>
<h1>按姓氏查找的结果</h1>
<br>
<hr color="gray">
<table width="450">
<tr>
<td align="center">
编号
</td>
<td align="center">
客户姓名
</td>
<td align="center">
公司名称
</td>
</tr>
<%int num=1;
String name=request.getParameter("name");
char[] ch_name=name.toCharArray();
DBConnect db=new DBConnect();
String query="select name from client";
db.excuteQuery(query);
while(db.next()){
String names=db.getString("name");
char[] ch_names=names.toCharArray();
int flag=1;
for(int i=0;i<name.length();i++){
if(ch_names[i]!=ch_name[i])
flag=0;
}
if(flag==1){
String querys="select company from client where name='"+names+"';";
db.excuteQuery(querys);
while(db.next()){%>
<tr>
<td align="center">
<%=num%>
</td>
<td align="center">
<%=names %>
</td>
<td align="center">
<%=db.getString("company")%>
</td>
<td align="center">
<form action="Client_infor_rework_find_exact.jsp" name="form" method="post">
<input name="name" type="hidden" value="<%=names%>">
<input name="company" type="hidden" value="<%=db.getString("company")%>">
</form>
<a href="javascript:moving();">详细信息</a>
</td>
</tr>
<% }
}
num++;
}%>
</table>
<br>
<a href="Client_find_firstname.jsp">返回上一级</a>
</center>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<%@ page import="com.bean.*,com.DB.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>客户信息察看</title>
<script language="JavaScript">
function checkgoto(){
document.form.submit();
}
</script>
<style>
a {text-decoration:none;font-family:黑体;font-size:medium;weight:bold}
a:link {color: black}
a:visited {color:black}
a:active {color:gray}
a:hover {color:red}
</style>
</head>
<body>
<%User user=new User();
int depart=user.getDepart();
DBConnect db=new DBConnect();
String query=null;
if(depart==0)
query="select * from client";
else
query="select * from client where depart='"+depart+"';";
db.excuteQuery(query);
%>
<center>
<h1>客户信息察看</h1>
<br><br><br>
<table width=600>
<tr>
<td>
客户编号
</td>
<td>
客户姓名
</td>
<td>
公司名称
</td>
</tr>
<%int num=1;
try{
while(db.next()){%>
<tr>
<td>
<%=num%>
</td>
<td>
<%=db.getString("name")%>
</td>
<td>
<%=db.getString("company")%>
</td>
<td align="center">
<form name="form" action="Client_infor_list.jsp" method="post">
<input name="name" type="hidden" value="<%=db.getString("name")%>">
<%System.out.println(db.getString("name"));%>
</form>
<a href="javascript:checkgoto();">详细信息</a>
</td>
</tr>
<%num++;
}
db.close();
}catch(Exception e){
e.printStackTrace();
}%>
</table>
<a href="Client_Access.jsp">返回上一级</a>
</center>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<%@ page import="com.DB.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>按年龄范围查找</title>
<script language="JavaScript">
function move(){
document.form.submit();
}
</script>
</head>
<body>
<center>
<h1>按姓氏查找的结果</h1>
<br>
<hr color="gray">
<table width="450">
<tr>
<td align="center">
编号
</td>
<td align="center">
客户姓名
</td>
<td align="center">
公司名称
</td>
</tr>
<%int age1=Integer.parseInt(request.getParameter("age1"));
int age2=Integer.parseInt(request.getParameter("age2"));
DBConnect db=new DBConnect();
String query="select name,company from client where age>="+age1+" and age<="+age2+";";
db.excuteQuery(query);
int num=1;
while(db.next()){%>
<tr>
<td align="center">
<%=num%>
</td>
<td align="center">
<%=db.getString("name")%>
</td>
<td align="center">
<%=db.getString("company")%>
</td>
<td align="center" valign="bottom">
<form action="Client_infor_rework_find_exact.jsp" name="form" method="post">
<input name="name" type="hidden" value="<%=db.getString("name")%>">
<input name="company" type="hidden" value="<%=db.getString("company")%>">
<input name="submit" type="submit" value="详细信息"/>
</form>
</td>
</tr>
<%
num++;
}%>
</table>
<br>
<a href="Client_find_firstname.jsp">返回上一级</a>
</center>
</body>
</html>
我调用数据库的表时,如果只有一个信息,就都能通过,如果大于等于2个内容(就是显示时为2行)就无法识别Script