<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="ISO-8859-1"%> <% String path 10
<%@pagelanguage="java"import="java.util.*,java.sql.*"pageEncoding="ISO-8859-1"%><%Str...
<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'loginCl.jsp' starting page</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>
<%
String u=request.getParameter("username");
String p=request.getParameter("passwd");
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection ct=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;databaseName=vote","xw","xw");
Statement sm=ct.createStatement();
ResultSet rs=sm.executeQuery("select passwd from user where username='"+u+"'");
if(rs.next()){
if(rs.getString(1).equals(p)){
response.sendRedirect("wel.jsp?user="+u);
}else{
response.sendRedirect("login.jsp?errNo=1");
}
}else{
response.sendRedirect("login.jsp?errNo2=2");
}
/* if(u.equals("shunping")&&p.equals("123")){
response.sendRedi response.sendRedirect("wel.jsp?user="+u); rect("wel.jsp?user="+u);
}
else
response.sendRedirect("login.jsp");
}*/
%>
</body>
</html> 展开
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'loginCl.jsp' starting page</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>
<%
String u=request.getParameter("username");
String p=request.getParameter("passwd");
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection ct=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;databaseName=vote","xw","xw");
Statement sm=ct.createStatement();
ResultSet rs=sm.executeQuery("select passwd from user where username='"+u+"'");
if(rs.next()){
if(rs.getString(1).equals(p)){
response.sendRedirect("wel.jsp?user="+u);
}else{
response.sendRedirect("login.jsp?errNo=1");
}
}else{
response.sendRedirect("login.jsp?errNo2=2");
}
/* if(u.equals("shunping")&&p.equals("123")){
response.sendRedi response.sendRedirect("wel.jsp?user="+u); rect("wel.jsp?user="+u);
}
else
response.sendRedirect("login.jsp");
}*/
%>
</body>
</html> 展开
4个回答
展开全部
なんに、これ?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
what are you doing
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我想说,你贴代码要干啥呢?
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询