jsp项目实现登陆注册示例,详细解释 - 爱问答

(爱问答)

jsp项目实现登陆注册示例,详细解释

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">  

   <label for="username"></label> 用户名    <input type="text" name="username" id="username">  

 

   <label for="passwrod"></label> 密码    <input type="text" name="passwrod" id="passwrod">  

 

   <input type="submit" name="button" id="button" value="提交">  

</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 ;

下一篇:电动抽奖的机器,所用的球,能植入芯片,像门禁那样利用读卡设备读取数据显示结果吗?那么小能实现吗?

上一篇:电源额定300w

热门标签:
excel 网盘 破解 word dll
最新更新:
微软重新评估新的Outlook的使用时机 联想推出搭载联发科Helio G80芯片组的Tab M9平板 英特尔创新大赛时间确定! 微软Edge浏览器在稳定渠道中推出Workspaces功能 英伟达RTX4060TiGPU推出MaxSun动漫主题! 谷歌地图为用户提供了街景服务! GameSir 在T4 Kaleid中推出了一款出色的控制器! 微软开始在Windows 11 中测试其画图应用程序的新深色模式! LG电子推出全球首款无线OLED电视 英伟达人工智能芯片崭露头角! Steam Deck可以玩什么游戏-Steam Deck价格限时优惠 雷蛇推出CobraPro鼠标 Kindle电子阅读器可以访问谷歌商店吗 Windows10如何加入组策略 window10图片查看器怎么没有了?