webJSP简单登录注册页面代码Word格式文档下载.docx
- 文档编号:988486
- 上传时间:2023-04-29
- 格式:DOCX
- 页数:7
- 大小:38.85KB
webJSP简单登录注册页面代码Word格式文档下载.docx
《webJSP简单登录注册页面代码Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《webJSP简单登录注册页面代码Word格式文档下载.docx(7页珍藏版)》请在冰点文库上搜索。
returnfalse;
}
if(document.dlForm.UserP.value=="
密码不能为空"
document.dlForm.UserP.focus();
document.dlForm.submit();
returntrue;
/script>
/head>
body>
center>
fontsize="
6"
>
欢迎进入登录界面<
/font>
formaction="
dlhou.jsp"
onsubmit="
returncheck()"
method="
post"
name="
dlForm"
p>
用户名:
inputtype="
text"
UserN"
style="
width:
148px;
"
/>
/p>
密&
nbsp;
&
码:
password"
UserP"
146px;
submit"
value="
登&
录&
height:
43px;
input type="
button"
value="
忘记密码"
onclick="
parent.location.href('
wangji.jsp'
)"
style="
43px;
返回主页"
welcome.jsp'
/FORM>
/center>
/body>
/html>
dlhou.jsp
%@pagelanguage="
java"
import="
java.sql.*"
jsp:
useBeanid="
SQLbean"
scope="
session"
class="
lian.Lian"
登录状态<
divalign="
center"
spanclass="
style1"
/span>
br>
hr>
/div>
%
StringuserN=request.getParameter("
StringuserP=request.getParameter("
//out.print(userN);
Stringsql="
select*fromyxxwhereyname='
+userN+"
'
;
SQLbean.OpenConn();
ResultSetrs=SQLbean.executeQuery(sql);
if(!
rs.next())
%>
用户名不存在!
window.location.href="
denglu.jsp"
//while(rs.next())
else
Stringp=rs.getString("
ypassword"
).trim();
if(p.equals(userP.trim()))
// response.sendRedirect("
zhu.jsp?
param="
+userN);
session.setAttribute("
yhm"
userN);
//response.sendRedirect("
zhu.jsp"
恭喜您,登录成功!
密码错误!
rs.close();
SQLbean.closeSt();
SQLbean.closeConn();
注册界面:
注册界面<
functionzcheck()
if(document.zcForm.UserN.value=="
document.zcForm.UserN.focus();
if(document.zcForm.UserP.value=="
密码不能为空"
document.zcForm.UserP.focus();
if(document.zcForm.reUserP.value=="
确认密码不能为空"
document.zcForm.reUserP.focus();
if(document.zcForm.reUserP.value!
=document.zcForm.UserP.value)
确认密码和密码不符"
returntrue;
欢迎进入注册界面<
4"
基本信息注册<
zchou.jsp"
returnzcheck()"
zcForm"
name="
155px;
fontcolor="
red"
*<
确认密码:
reUserP"
性&
别:
radio"
UserS"
value="
Mr."
checked="
checked"
男&
Ms."
女&
年&
龄:
UserA"
密码找回问题设置<
问题1:
你最尊敬的老师是?
答案1:
Q1"
style="
155px;
问题2:
你最喜欢的学科是?
答案2:
Q2"
问题3:
你最喜欢的运动是?
答案3:
Q3"
确定"
确&
定&
33px;
/form>
注册状态<
StringuserS=request.getParameter("
StringuserA=request.getParameter("
Stringq1=request.getParameter("
Stringq2=request.getParameter("
Stringq3=request.getParameter("
SQLbean.OpenConn();
Stringsqly="
ResultSetrsy=SQLbean.executeQuery(sqly);
if(rsy.next())
用户名已被注册,请更换用户名"
zhuce.jsp"
String sql="
insert into yxxvalues('
'
+userP+"
+userS+"
+userA+"
Stringsql2="
insertintoyyzvalues('
+q1+"
+q2+"
+q3+"
SQLbean.executeUpdate(sql);
SQLbean.executeUpdate(sql2);
SQLbean.closeSt();
注册成功,将跳转登录界面"
window.location.href="
//wrq经试验表明sendRedirect()还没显示
alert提示就已经跳转
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- webJSP 简单 登录 注册 页面 代码