日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

html 登陆sql server,jsp实现注册与登录页面+sqlsever2008

發布時間:2023/12/1 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 html 登陆sql server,jsp实现注册与登录页面+sqlsever2008 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

//index.jsp

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

登陸

用戶登陸

用戶名:
密? 碼:

注冊新用戶

//

Logon.jsp

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

登陸確認

function BackWard()

{

history.back();

}

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();

//"com.microsoft.sqlserver.jdbc.SQLServerDriver"要與驅動類名一樣

String url="jdbc:sqlserver://localhost:1433;databaseName=STUDENT";

//STUDENT為數據庫名

String user="sa";

String userpassword="123456";

Connection conn= DriverManager.getConnection(url,user,userpassword);

Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

boolean a;

String uid=request.getParameter("uid");

String password=request.getParameter("password");

String sql="select * from S where UID='"+uid+"' and Password='"+password+"'";

ResultSet rs=stmt.executeQuery(sql);

a=rs.next();

if(a==false)

{rs.close();

session.setAttribute("uid",uid);

%>

用戶名或密碼錯誤,請重新填寫!

else

{

rs.close();

%>

:)歡迎您

//Register1.jsp

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

注冊信息確認

function backward()

{

history.back();

}

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();

//"com.microsoft.sqlserver.jdbc.SQLServerDriver"要與驅動類名一樣

String url="jdbc:sqlserver://localhost:1433;databaseName=STUDENT";

//STUDENT為數據庫名

String user="sa";

String userpassword="123456";

Connection conn= DriverManager.getConnection(url,user,userpassword);

Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

String uid=request.getParameter("uid");

String sql="select * from S where uid='"+uid+"'";

ResultSet rs=stmt.executeQuery(sql);

if(rs.next())

{

rs.close();

stmt.close();

conn.close();

%>

用戶名不能重名,請重新選擇!

else{

rs.close();

String username=request.getParameter("username");

String sex=request.getParameter("sex");

String password=request.getParameter("password");

%>

請認真檢查下面的注冊申請單.
用 戶 名:
密??? 碼:
性??? 別:
真實姓名:

//Register2.jsp

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

注冊確認

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();

//"com.microsoft.sqlserver.jdbc.SQLServerDriver"要與驅動類名一樣

String url="jdbc:sqlserver://localhost:1433;databaseName=STUDENT";

//STUDENT為數據庫名

String user="sa";

String userpassword="123456";

Connection conn= DriverManager.getConnection(url,user,userpassword);

Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

String uid=request.getParameter("uid");

String username=request.getParameter("username");

String sex=request.getParameter("sex");

String password=request.getParameter("password");

String sql="insert into S values('"+uid+"','"+username+"','"+sex+"','"+password+"')";

stmt.executeUpdate(sql);

%>

:祝賀您,注冊成功!

3秒后自動返回登陸窗口,如果你不想等待,可以點擊這里返回首頁

//Logoff.jsp

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

用戶注銷

成功注銷!

5秒后自動返回首頁,如果你不想等待,可以點擊這里返回首頁

//Register.jsp

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

用戶注冊

總結

以上是生活随笔為你收集整理的html 登陆sql server,jsp实现注册与登录页面+sqlsever2008的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。