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

热点内容
win10用子文件夹改名 浏览:234
ae钢笔工具在哪里 浏览:460
gn105数据线插哪里 浏览:916
破锁屏密码方法 浏览:835
股票数据放哪里 浏览:576
m格式库文件 浏览:279
天际通数据服务怎么开票 浏览:430
写小说发哪个网站比较好 浏览:244
小米电视3蓝牙文件路径 浏览:111
shell读取文件值 浏览:909
文件夹路径栏消失 浏览:795
律师哪些业务不能代替大数据 浏览:952
lol哪些文件可以删除 浏览:701
汇编程序中del是什么意思 浏览:183
幼儿园免费网站模板下载 浏览:210
w619线刷教程 浏览:759
怎么培养编程思想 浏览:697
手机捆绑app的软件怎么卸载 浏览:32
vb编程器有什么用 浏览:999
excel如何分列数据与文字 浏览:884

友情链接