是登陆问题
代码:
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.sql.*" %>
<html>
<head>
<script language="javascript" type="text/javascript">
<!--
function onClick()
{
this.location.replace("register.jsp");
}
-->
</script>
<title>用户登录 </title>
<style type="text/css">
<!--
.STYLE1 {
color: #333333;
font-weight: bold;
font-size: large;
}
-->
</style>
</head>
<body>
<%
try
{
String strId="";
String strName="";
String strPassword="";
String strMsg="";session.setAttribute("loginId","");
strId=request.getParameter("id");
strPassword=request.getParameter("password");if(strId!=null && strPassword!=null && !strId.equals("")&&!strPassword.equals(""))
{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:yunshu");
Statement statement=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs=null;
String String_SQL="select id from sjinfo where id='"+strId+"' and password='"+strPassword+"'";
rs=statement.executeQuery(String_SQL);
if(!rs.next())
{strMsg="你输入的用户名或密码不正确,请重新输入!";out.println("123"+strMsg);
%>
<script language="javascript" type="text/javascript">
<!--
alert("重新输入");
-->
</script>
<%
}
else
{
session.setAttribute("loginId",strId);
response.sendRedirect("main.jsp");
rs.close();
statement.close();
con.close();
}
}
}
catch(Exception e)
{
out.println("错误"+e.getMessage());
}
%>
<center>
<span class="STYLE1">司机登陆</span><br>
<table border="1" bodercolor="royalbule" bgcolor="lightblue" width="400">
<tr><td>用户号:</td><td><input type="text" name="id"></td></tr>
<tr><td>密码:</td><td><input type="password" name="password"></td></tr>
</table>
<input type="submit" value="登录">
<input type="reset" value="重填">
<input type="button" onClick="onClick()" value="注册"><!-- 去登记 -->
</form>
</center>
</body>
</html>数据库: ID 主
sj_name
sj_sex
sj_phone
sj_address
sj_password 用户名和密码输进去后 点确定没反应
大虾们帮我看看
代码:
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.sql.*" %>
<html>
<head>
<script language="javascript" type="text/javascript">
<!--
function onClick()
{
this.location.replace("register.jsp");
}
-->
</script>
<title>用户登录 </title>
<style type="text/css">
<!--
.STYLE1 {
color: #333333;
font-weight: bold;
font-size: large;
}
-->
</style>
</head>
<body>
<%
try
{
String strId="";
String strName="";
String strPassword="";
String strMsg="";session.setAttribute("loginId","");
strId=request.getParameter("id");
strPassword=request.getParameter("password");if(strId!=null && strPassword!=null && !strId.equals("")&&!strPassword.equals(""))
{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:yunshu");
Statement statement=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs=null;
String String_SQL="select id from sjinfo where id='"+strId+"' and password='"+strPassword+"'";
rs=statement.executeQuery(String_SQL);
if(!rs.next())
{strMsg="你输入的用户名或密码不正确,请重新输入!";out.println("123"+strMsg);
%>
<script language="javascript" type="text/javascript">
<!--
alert("重新输入");
-->
</script>
<%
}
else
{
session.setAttribute("loginId",strId);
response.sendRedirect("main.jsp");
rs.close();
statement.close();
con.close();
}
}
}
catch(Exception e)
{
out.println("错误"+e.getMessage());
}
%>
<center>
<span class="STYLE1">司机登陆</span><br>
<table border="1" bodercolor="royalbule" bgcolor="lightblue" width="400">
<tr><td>用户号:</td><td><input type="text" name="id"></td></tr>
<tr><td>密码:</td><td><input type="password" name="password"></td></tr>
</table>
<input type="submit" value="登录">
<input type="reset" value="重填">
<input type="button" onClick="onClick()" value="注册"><!-- 去登记 -->
</form>
</center>
</body>
</html>数据库: ID 主
sj_name
sj_sex
sj_phone
sj_address
sj_password 用户名和密码输进去后 点确定没反应
大虾们帮我看看
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货