<%
request.setCharacterEncoding("gbk");
String telnum = (String)request.getParameter("numcheck");if(telnum == null && telnum.trim() == "") {
response.sendRedirect("checkok.jsp");
out.println("请输入号码");
} else {
Class.forName("com.mysql.jdbc.Driver");
String url= "jdbc:mysql://localhost:3306/clientmanage?user=root&password=absolute";
Connection conn = DriverManager.getConnection(url);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from clientlist where telnum = " + telnum);
}
%>判断传过来的号码是否为空,如果为空就重定向,如果不为空就连接数据库。
request.setCharacterEncoding("gbk");
String telnum = (String)request.getParameter("numcheck");if(telnum == null && telnum.trim() == "") {
response.sendRedirect("checkok.jsp");
out.println("请输入号码");
} else {
Class.forName("com.mysql.jdbc.Driver");
String url= "jdbc:mysql://localhost:3306/clientmanage?user=root&password=absolute";
Connection conn = DriverManager.getConnection(url);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from clientlist where telnum = " + telnum);
}
%>判断传过来的号码是否为空,如果为空就重定向,如果不为空就连接数据库。
解决方案 »
- 我受不鸟了-一个ie与firefox在处理文件路径上的问题
- 哪里有j2ee视频的下载啊 最好是尚学堂马士兵的
- MyEclipse 设置webService的WSDL时,出现an error occurred while completing process -javalangreflectInvocation
- 请教一个Hibernate映射文件的问题。
- JMS的C/S模式和B/S模式差异,help
- 地址栏怎么加密
- 各们大人帮个忙
- dom4j怪问题,高分求解!
- 写xml彧xhtml时,有时参考网上某个网址的DTD,可是这个网址上这个文件根本不存在...
- 部署过The Duker's Bank的兄弟进来帮我看看行吗?最后一步出错阿。。谢谢阿。。。。
- 跟大家分享一下,json中文传值问题。
- 对于普通bean是不是载入一个配置文件就创建一个容器呢?
还是报错,不知道咋回事
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ page import="java.sql.*" %><%
request.setCharacterEncoding("gbk");
String telnum = (String)request.getParameter("numcheck");Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
if(telnum == null && telnum.trim() == "") {
response.sendRedirect("checkok.jsp");
out.println("请输入号码");
} else {
Class.forName("com.mysql.jdbc.Driver");
String url= "jdbc:mysql://localhost:3306/clientmanage?user=root&password=absolute";
conn = DriverManager.getConnection(url);
stmt = conn.createStatement();
rs = stmt.executeQuery("select * from clientlist where telnum = " + telnum);
}
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>用户信息查询</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head>
<body>
<form name="checkclient" action="checkok.jsp" method="post">
<div align="center">
手机号码:
<input type="text" name="numcheck">
<input type="submit" name="submit" value="查询">
</div>
</form>
<br><br>
<table width="700"align="center" border="5" bordercolor="#99CCFF" cellspacing="3" cellpadding="5">
<caption><h1 >用户信息</h1></caption>
<th bgcolor="#99CCFF">用户姓名</th>
<th bgcolor="#99CCFF">用户车牌</th>
<th bgcolor="#99CCFF">用户号码</th>
<th bgcolor="#99CCFF">服务地点</th>
<th bgcolor="#99CCFF">备注</th>
<th bgcolor="#99CCFF">性别</th>
<th bgcolor="#99CCFF">时间</th>
<th bgcolor="#99CCFF">次数</th>
<% while(rs.next()) { %>
<tr>
<td><%= rs.getString("name") %></td>
<td><%= rs.getString("carnum") %></td>
<td><%= rs.getString("telnum") %></td>
<td><%= rs.getString("location") %></td>
<td><%= rs.getString("re") %></td>
<td><%= rs.getString("sex") %></td>
<td><%= rs.getDate("date") %></td>
<td><%= rs.getString("count") %></td>
</tr>
<% } %>
</table><br><br>
<div align="center">
<a href="main.jsp" target="_parent">返回首页</a>
</div> <% rs.close();
stmt.close();
conn.close();
%>
</body>
</html>这个是我完整的代码