導航:首頁 > 編程語言 > eclipse登錄注冊代碼

eclipse登錄注冊代碼

發布時間:2023-07-21 11:07:52

1. 如何用eclipse寫登錄注冊頁面的代碼

java寫的用戶登錄實例,實際頁面展示使用的jsp,那麼下面是jsp的登錄頁面代碼:
1、login.jsp代碼
<%
string name = request.getparameter("username");
string pwd = request.getparameter("password");
//out.println(name+pwd);
string sql ="select * from info where username='"+name+"' and password='"+pwd+"'";
//out.println(sql);
statement stm= null;
resultset rs =null;
try
{
stm = conn.createstatement();
rs = stm.executequery(sql);
if(rs.next())
{
session.setattribute("username",name);
response.sendredirect("index.html");
}
else
{
response.sendredirect("index1.html");
}
}
catch(sqlexception e)
{
e.printstacktrace();
}
%>
<!--登錄的表單-->
<form name="form1" method="post" action="login.jsp">
<p>
<label for="username"></label> 用戶名
<input type="text" name="username" id="username">
</p>
<p>
<label for="passwrod"></label> 密碼
<input type="text" name="passwrod" id="passwrod">
</p>
<p>
<input type="submit" name="button" id="button" value="提交">
</p>
</form>
2、用戶信息表,存放用戶名和密碼:
user_info 表
create table if not exists `test` (
`id` int(8) not null auto_increment,
`username` char(150) default null,
`password` varchar(32),
`times` int(4) not null,
primary key (`id`)
) engine=myisam default charset=utf8 auto_increment=1 ;

2. java寫的用戶登陸實例,用eclipse開發的具體步奏和代碼

java寫的用戶登錄實例,實際頁面展示使用的jsp,那麼下面是jsp的登錄頁面代碼:
1、login.jsp代碼
<%
string name = request.getparameter("username");
string pwd = request.getparameter("password");
//out.println(name+pwd);
string sql ="select * from info where username='"+name+"' and password='"+pwd+"'";
//out.println(sql);
statement stm= null;
resultset rs =null;
try
{
stm = conn.createstatement();
rs = stm.executequery(sql);
if(rs.next())
{
session.setattribute("username",name);
response.sendredirect("index.html");
}
else
{
response.sendredirect("index1.html");
}
}
catch(sqlexception e)
{
e.printstacktrace();
}
%>
<!--登錄的表單-->
<form name="form1" method="post" action="login.jsp">
<p>
<label for="username"></label> 用戶名
<input type="text" name="username" id="username">
</p>
<p>
<label for="passwrod"></label> 密碼
<input type="text" name="passwrod" id="passwrod">
</p>
<p>
<input type="submit" name="button" id="button" value="提交">
</p>
</form>
2、用戶信息表,存放用戶名和密碼:
user_info 表
create table if not exists `test` (
`id` int(8) not null auto_increment,
`username` char(150) default null,
`password` varchar(32),
`times` int(4) not null,
primary key (`id`)
) engine=myisam default charset=utf8 auto_increment=1 ;

閱讀全文

與eclipse登錄注冊代碼相關的資料

熱點內容
魅族pro5自帶瀏覽器怎麼升級 瀏覽:342
為什麼用數據還是載入慢 瀏覽:171
監控下面有網路如何隔離 瀏覽:748
前台中jrequestjson 瀏覽:435
怎麼在word里粘貼xls文件 瀏覽:710
買火車票什麼網站 瀏覽:757
jsp的六大 瀏覽:216
圖文數據要如何導入資料庫 瀏覽:207
軟體數據刪了恢復怎麼弄 瀏覽:517
小米筆記本電腦共享文件 瀏覽:812
cad字體文件夾添加國標字體 瀏覽:938
電腦輸出pdf文件有什麼用 瀏覽:695
微信滿人 瀏覽:585
js點擊按鈕下載圖片 瀏覽:922
數據有效性哪裡設置的 瀏覽:171
orl刪除表的資料庫 瀏覽:353
cad文件0位元組可以修復么 瀏覽:675
瀏覽器下載的軟體在文件中怎麼找 瀏覽:906
怎麼把word圖片變小 瀏覽:278
cf的文件夾 瀏覽:556

友情鏈接