JSP制作带有数据库网页javaee课程设计 - 图文

2、过程代码: 1、

在在netbeans中新建一个名为sherry的web应用程序:

2、 将数据库驱动加入netbeans下的文件夹中,加入驱动程序: com.microsoft.sqlserver.jdbc.SQLServerDriver

jdbc:sqlserver://localhost:1433;DatabaseName=test\

3、核心代码: 首页:

登陆首页

       

(1) 登录:

<%@page import=\<%

String susername=request.getParameter(\

String isusername=new String(susername.getBytes(\ String spassword=request.getParameter(\

String ispassword=new String(spassword.getBytes(\ String sselect=request.getParameter(\ Class.forName(\ Connection

con=DriverManager.getConnection(\est\ Statement

sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); ResultSet rs; if(sselect.equals(\ rs=sql.executeQuery(\* from users where userID='\and upass='\ if(rs.next()) {response.sendRedirect(\ else response.sendRedirect(\ } else { rs=sql.executeQuery(\* from guanli where guanliID='\and gpass='\ if(rs.next()) {response.sendRedirect(\ else response.sendRedirect(\ } con.close();

%>

<%

//获取登录时输入的用户名并储存起来 session.setAttribute(\%>

登陆错误:

登录错误

(2)注册:

注册

联系客服:779662525#qq.com(#替换为@)