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

热点内容
配置文件替换 浏览:117
mac右键没有删除文件 浏览:624
苹果手机游戏文稿和数据在哪清理 浏览:326
qq旋风文件名 浏览:270
手机system文件 浏览:672
我的网络被房东禁了 浏览:505
c获取配置文件 浏览:476
苹果5s5gwifi 浏览:261
棋类程序编程一般用什么算法 浏览:792
dnf86版本红字 浏览:452
xp去掉域登陆密码 浏览:729
淘宝全屏显示代码 浏览:921
大数据内涵体现在下列哪个方面 浏览:105
数据网络怎么自己打开了 浏览:688
可编程控制器的优点有哪些 浏览:623
g502配置文件 浏览:159
1024b数据多少字节 浏览:720
java俄罗斯方块设计说明书 浏览:313
英雄联盟710版本锐雯 浏览:818
keil编译后显示代码大小 浏览:959

友情链接