请问那里有比较完整的JSP LOGIN代码 http://expert.csdn.net/Expert/topic/1692/1692167.xml?temp=.8294794那里有我帖的代码。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 谢谢,不过你的那个 cardBean.java编译不了,好像有问题 我给你:<html><head><title>用户登录</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css"><!--td { font-size: 12px; line-height: 120%;}--></style><style type="text/css"><!--.link1 { font-size: 12px; font-weight: bold; color: #040095; text-decoration: none;}.link1:hover { font-size: 12px; font-weight: bold; color: #FF0000; text-decoration: underline;}--></style></head><body background="images/bg_whole.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><center> <br> <br> <br> <br><form name="login" method="post" action="login_check.jsp"> <table width="576" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="185" height="55" align="left" valign="top"colspan="1"><img src="images/company/gzdx/logo1.gif" width="180" height="55"></td> <td width="391" align="center" valign="top" colspan="2"><img src="images/company/gzdx/cmpy_name1.gif" height="55"></td> </tr> </table> </td> </tr> <tr> <td align="left" valign="top"><table width="576" height="291" border="0" cellpadding="0" cellspacing="15" bgcolor="#8EBCEE"> <tr> <td align="left" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="25" colspan="4"> </td> </tr> <tr> <td width="18"> </td> <td width="283"><img src="images/xx.jpg" width="273" height="208"></td> <td width="235" align="left" valign="top"><table width="235" height="208" border="0" cellpadding="0" cellspacing="0" bgcolor="#CFCFCF"> <tr align="left" valign="middle"> <td height="25" colspan="3"> <font color="#CF090A">请输入登录信息</font></td> </tr> <tr> <td width="8"> </td> <td height="129" align="left" valign="top" bgcolor="#FFFFFF"><table width="100%" height="129" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="95" align="center" valign="middle"><table width="85%" border="0" cellspacing="4" cellpadding="0"> <tr> <td>用户名:</td> <td> <input type="text" name="name" size="15" value="" maxlength="30"> <input type="hidden" name="rname" size="15" value="" maxlength="30"> </td> </tr> <tr> <td>密 码:</td> <td> <input type="password" name="password" value="" size=15 maxlength="30"> </td> </tr> </table></td> </tr> <tr> <td align="center" valign="top"><table width="80%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="64%"> </td> <td width="36%"><input type="image" src="images/company/gzdx/denglu.gif" width="54" height="19"></td> </tr> </table></td> </tr> </table></td> <td width="8"> </td> </tr> <tr align="center"> <td colspan="3">建议使用IE6.0版本,<a href="http://download.microsoft.com/download/ie6sp1/finrel/6_sp1/W98NT42KMeXP/CN/ie6setup.exe" class="link1" alt="开始下载IE6.0安装程序">在此下载</a><br> </span></td> </tr> </table></td> <td width="10" align="left" valign="top"> </td> </tr> </table></td> </tr> </table></td> </tr> </table> </form></center></body></html> 给你一个很简单的。表结构:(表名users)用户名(id),密码(password):(都是varchar)我用的是数据库sql2000。登陆:(login.jsp)<%@ page contentType = "text/html;charset = GB2312" %><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>登录页面</title></head><body><form action="validate.jsp" method=post> <p align=left><font color=#666666>用 户</font> <input maxlength=10 name="id" size=10><font color=#666666>密 码</font> <input maxlength=10 name="password" size=10 type=password> <input id=submit13 name=submit1 type=submit value=登录> </p> </form></body></html>判断页面:(validate.jsp)<%@ page import="java.sql.*" contentType="text/html; charset=GB2312" %><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>Validate</title></head><body> <% String name=new String(); name=new String((request.getParameter("id")).getBytes("ISO8859-1"),"gb2312"); session.putValue("thename",name); %> <% int n; String temp1=new String(); String temp2=new String(); temp1 = new String((request.getParameter("id")).getBytes("ISO8859-1"),"gb2312"); temp2 = request.getParameter("password"); n = temp1.length()*temp2.length(); if (n==0) { %> <jsp:forward page="login.jsp" /> <% } else{ String url=new String(); url="jdbc:microsoft:sqlserver://202.119.121.226:1433;DatabaseName=tzku"; String ur=new String(); ur="sa"; String pw=new String(); pw="12345"; Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); Connection con=DriverManager.getConnection(url,ur,pw); Statement stmt=con.createStatement(); String SQL=new String(); SQL = "SELECT * FROM users WHERE id='"+temp1+"'and password='"+temp2+"'"; ResultSet rs = stmt.executeQuery(SQL); if(rs.next()) { String username=new String((rs.getString("id")).getBytes("ISO8859-1"),"gb2312"); if(username.equals("admin")) { %> <jsp:forward page="adminIndex.jsp" /> <% rs.close(); } else{ %> <jsp:forward page="mainchoose.jsp" /> <% } } else { %> <jsp:forward page="LoginAgain.jsp" /> <% } stmt.close(); con.close(); } %></body></html> svn可以远程团队开发吗 一个关于json的问题 sql server 2000的jdbc驱动是什么 程序员不光是软件的,而且还必须是搞硬件的! javascro[t 调用ocx返回值错误? java匿名类 请教一下jsp页面可编辑表格(明细表,可增删记录)保存时的机制 jsp如何调用另外的jsp网页,并获得其html结果保存到数组? filter问题:filterChain是什么东东? 在jbuilder里启动tomcat时,老是将web.xml文件重写,导致我自己的东东总是被冲掉,起不了作用,我该怎么办? 中文显示 如何配置oracle与tomcat的数据源
<html>
<head>
<title>用户登录</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
td {
font-size: 12px;
line-height: 120%;
}
-->
</style>
<style type="text/css">
<!--
.link1 {
font-size: 12px;
font-weight: bold;
color: #040095;
text-decoration: none;
}
.link1:hover {
font-size: 12px;
font-weight: bold;
color: #FF0000;
text-decoration: underline;
}
-->
</style></head><body background="images/bg_whole.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
<br>
<br>
<br>
<br><form name="login" method="post" action="login_check.jsp"> <table width="576" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="185" height="55" align="left" valign="top"colspan="1"><img src="images/company/gzdx/logo1.gif" width="180" height="55"></td>
<td width="391" align="center" valign="top" colspan="2"><img src="images/company/gzdx/cmpy_name1.gif" height="55"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top"><table width="576" height="291" border="0" cellpadding="0" cellspacing="15" bgcolor="#8EBCEE">
<tr>
<td align="left" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25" colspan="4"> </td>
</tr>
<tr>
<td width="18"> </td>
<td width="283"><img src="images/xx.jpg" width="273" height="208"></td>
<td width="235" align="left" valign="top"><table width="235" height="208" border="0" cellpadding="0" cellspacing="0" bgcolor="#CFCFCF">
<tr align="left" valign="middle">
<td height="25" colspan="3"> <font color="#CF090A">请输入登录信息</font></td>
</tr>
<tr>
<td width="8"> </td>
<td height="129" align="left" valign="top" bgcolor="#FFFFFF"><table width="100%" height="129" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="95" align="center" valign="middle"><table width="85%" border="0" cellspacing="4" cellpadding="0">
<tr>
<td>用户名:</td>
<td>
<input type="text" name="name" size="15" value="" maxlength="30">
<input type="hidden" name="rname" size="15" value="" maxlength="30">
</td>
</tr>
<tr>
<td>密 码:</td>
<td>
<input type="password" name="password" value="" size=15 maxlength="30">
</td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" valign="top"><table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="64%"> </td>
<td width="36%"><input type="image" src="images/company/gzdx/denglu.gif" width="54" height="19"></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="8"> </td>
</tr>
<tr align="center">
<td colspan="3">建议使用IE6.0版本,<a href="http://download.microsoft.com/download/ie6sp1/finrel/6_sp1/W98NT42KMeXP/CN/ie6setup.exe" class="link1" alt="开始下载IE6.0安装程序">在此下载</a><br>
</span></td>
</tr>
</table></td>
<td width="10" align="left" valign="top"> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</form>
</center>
</body>
</html>
登陆:(login.jsp)
<%@ page contentType = "text/html;charset = GB2312" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登录页面</title>
</head>
<body>
<form action="validate.jsp" method=post>
<p align=left><font color=#666666>用 户</font>
<input maxlength=10 name="id" size=10><font color=#666666>密 码</font>
<input maxlength=10 name="password" size=10 type=password>
<input id=submit13 name=submit1 type=submit value=登录>
</p>
</form>
</body>
</html>
判断页面:(validate.jsp)
<%@ page import="java.sql.*"
contentType="text/html; charset=GB2312" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Validate</title>
</head>
<body>
<%
String name=new String();
name=new String((request.getParameter("id")).getBytes("ISO8859-1"),"gb2312");
session.putValue("thename",name);
%>
<%
int n;
String temp1=new String();
String temp2=new String();
temp1 = new String((request.getParameter("id")).getBytes("ISO8859-1"),"gb2312");
temp2 = request.getParameter("password");
n = temp1.length()*temp2.length();
if (n==0) {
%>
<jsp:forward page="login.jsp" />
<%
}
else{
String url=new String();
url="jdbc:microsoft:sqlserver://202.119.121.226:1433;DatabaseName=tzku";
String ur=new String();
ur="sa";
String pw=new String();
pw="12345";
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con=DriverManager.getConnection(url,ur,pw);
Statement stmt=con.createStatement();
String SQL=new String();
SQL = "SELECT * FROM users WHERE id='"+temp1+"'and password='"+temp2+"'";
ResultSet rs = stmt.executeQuery(SQL);
if(rs.next()) {
String username=new String((rs.getString("id")).getBytes("ISO8859-1"),"gb2312");
if(username.equals("admin")) {
%>
<jsp:forward page="adminIndex.jsp" />
<%
rs.close();
}
else{
%>
<jsp:forward page="mainchoose.jsp" />
<%
}
}
else {
%>
<jsp:forward page="LoginAgain.jsp" />
<%
}
stmt.close();
con.close();
}
%>
</body>
</html>