当前位置:首页 > 代码 > 正文

jsp页面代码大全(Jsp页面)[20240423更新]

admin 发布:2024-04-23 23:35 188


本篇文章给大家谈谈jsp页面代码大全,以及Jsp页面对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

编写用户注册于登录的JSP页面的全部程序代码

3个jsp文件,第一个是login.jsp,第二个是judge.jsp,第三个是afterLogin.jsp

%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%

%@ page import="java.util.*" %

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

html

head

title登录页面/title

/head

body

form name="loginForm" method="post" action="judgeUser.jsp"

table

tr

td用户名:input type="text" name="userName" id="userName"/td

/tr

tr

td密码:input type="password" name="password" id="password"/td

/tr

tr

tdinput type="submit" value="登录" style="background-color:pink" input type="reset" value="重置" style="background-color:red"/td

/tr

/table

/form

/body

/html

%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%

%@ page import="java.util.*" %

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

html

head

title身份验证/title

/head

body

%

request.setCharacterEncoding("GB18030");

String name = request.getParameter("userName");

String password = request.getParameter("password");

if(name.equals("abc") password.equals("123")) {

%

jsp:forward page="afterLogin.jsp"

jsp:param name="userName" value="%=name%"/

/jsp:forward

%

}

else {

%

jsp:forward page="login.jsp"/

%

}

%

/body

/html

%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

html

head

title登录成功/title

/head

body

%

request.setCharacterEncoding("GB18030");

String name = request.getParameter("userName");

out.println("欢迎你:" + name);

%

/body

/html

jsp程序代码

%@ page language="java" import="java.util.*" errorPage="error.jsp" pageEncoding="UTF-8"%

% request.setCharacterEncoding("GBK");%

html

head

title动作处理页面/title

/head

body background="C:\tp\yy.JPG"

font color=yellow

centerbrh2

jsp:useBean id="loginbean" class="com.login.LoginBean"/jsp:useBean //使用jsp:useBean标签调用LoginBean.java,class指明JavaBean位置

jsp:setProperty name="loginbean" property="*" ///设置LoginBean的属性值

%out.println("用户号为:"+loginbean.getUserid()+"brbr"); 输出loginbean里面getUserid的值

if (loginbean.getUserid()==null){ //如果用户名为空

throw new Exception("尊敬的用户:系统登录页面中的用户名不能为空,请输入用户号!");

}

if (loginbean.getPsw()==null){ //如果密码为空

throw new Exception("尊敬的用户:系统登录页面中的密码不能为空,请输入密码!");

}

if (loginbean.getPsw().equalsIgnoreCase("neusoft")) //如果JavaBean的密码和输入密码相同

{

String puserid = request.getParameter("userid"); //获得此用户ID

Cookie cookies[] = request.getCookies();

//如果是上一步提交过来的,则更新Cookie的值

if(puserid != null) {

Cookie c = new Cookie("userid", puserid);

c.setMaxAge(60*60*24*30); //Cookie的有效期为1个月setMaxAge()是Cookie 的一个方法

器单位为秒

60*60*24*30等与30天*24小时*60分*60秒==结果就为1个月的秒数

response.addCookie(c);

}

session.setAttribute("login","ok");

session.setMaxInactiveInterval(-1);

%

jsp:forward page="success.jsp" / //跳转至success.jsp

%

}

else { //如果密码不正确则执行

out.println("对不起,密码输入错误!您此次系统登陆失败!请重新输入密码!brbr");

out.println("A href=login.jsp返回/Abr");

}

%

h2

br

hr

/font

/body

/html

答题完毕

jsp页面的代码

Vector v=(Vector)application.getAttribute("Mess");//这行代码是声明一个Vector 变量,此变量是一个键值对象

其他的太 多了不想写

jsp 登陆界面的代码

登录判断的页面代码

%@ page contentType="text/html; charset=gb2312"%

%@ page import="java.sql.*"%

%@ page import="java.util.*"%

%@ include file="conn.jsp"%

%request.setCharacterEncoding("gb2312");

Statement stat=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

String name=request.getParameter("name");

String password=request.getParameter("password");

ResultSet rs=stat.executeQuery("select * from sjb where name='"+name+"'and pass='"+password+"'");

%

%if(rs.next()){%

%String shenfen=rs.getString(6);

session.setAttribute("name",name);

response.sendRedirect("index1.jsp");

}else{

out.print("帐号密码输入错误");%

a href="index1.jsp"点击返回/a

%}%

登录输入时的代码

form action="login.jsp" method="post" name="form1" class="STYLE1" id="form1"

帐号

label

input name="name" type="text" id="name" tabindex="1" size="13" maxlength="13" /

/label

A href="regedit.jsp"注册/A

密码

label

input name="password" type="password" id="password" size="13" maxlength="13" /

/label

a href="forget.jsp"忘记/a

label

input type="submit" name="Submit" value="确定" /

/label

label

input type="reset" name="Submit2" value="重填" /

/label

/form

求jsp代码详解……

Hwnd = Plugin.Window.GetKeyFocusWnd()

Delay 2000

t1=now:t2=now:sj1=0.5:sj2=60

Rem abcc

Delay 20

If DateDiff("s",t1,now)=sj1

Delay 10

Call Plugin.Bkgnd.KeyPress(Hwnd, 83)

Delay 10

t1=now

End If

If DateDiff("s",t2,now)=sj2

Delay 10

Call Plugin.Bkgnd.KeyPress(Hwnd, 70)

t2=now

End If

Goto abcc

jsp页面代码大全的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于Jsp页面、jsp页面代码大全的信息别忘了在本站进行查找喔。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/390.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载