请问用JSP+ACCESS做的会员登录与注册的代码怎么写

来源:百度知道 编辑:UC知道 时间:2024/05/23 00:38:34

主要就是一个数据库操作的步骤,给你个简单的例子,
1。由登陆页面跳转过来后的处理
<%@ page contentType="text/html;charset=gb2312" language="java" import="java.sql.*"%>
<%@ include file="conn.jsp"%>
<%
String username = request.getParameter("username");
String password = request.getParameter("password");
String sql ="select * from user where username='"+username+"' and password='"+password+"'";
try{
//PreparedStatement stmt = (PreparedStatement) conn.prepareStatement(url);
Statement stmt=conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
if(rs != null){
session.setAttribute("admin",username);
out.print("<script language='javascript'>");
out.print("window.location.href='admin_index.jsp';");
out.print("</script>&quo