导航:首页 > 编程语言 > 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登录注册代码相关的资料

热点内容
文件斜着的一排字用ps怎么删除 浏览:995
港版iphone5ios7有几种系统 浏览:770
qq欢迎使用影音播放 浏览:322
网络打印机怎么查看电脑的密码 浏览:980
淘宝卖二手的app叫什么名字 浏览:217
安卓代码读取界面信息 浏览:714
数控车床车55度螺纹怎么编程 浏览:391
word桌面找不到文件 浏览:585
数控车床编程怎么做到的 浏览:639
哈尔滨市行政区划代码 浏览:716
如何显示文件扩张 浏览:283
ps怎么移植文件 浏览:443
传奇补丁文件说明 浏览:513
奥维地图怎么设置网络叠加 浏览:407
linux加载库文件so失败 浏览:714
大家都想要的app 浏览:58
程序员比特币 浏览:568
mysqlfrm是什么文件 浏览:665
win10点击文件夹声音消失 浏览:963
苹果手机空白文件名 浏览:833

友情链接