初学者:JSP登陆界面
学生登陆查询系统
1 程序的主要功能及特点
实现一个登录界面的基本功能,具体要求:
- 登录界面login.jsp含有表单,用户能够输入用户名和密码,并提交表单给verify.jsp。
- Verify.jsp读取表单信息,并验证接收的用户名和密码是否与verify.jsp内置的相应变量值一致。
- 如果一致,则转向页面success.jsp,显示"成功登录"并可以手动选择要查询的系统。
- 如果不一致,则转向页面failure.jsp,显示"登录失败"并手动返回。
- 本系统默认:用户名14347119密码wuxing为正确。
2 程序部署及运行截图和相应说明(手工部署)
部署
- 成功登陆后可以选择登陆某一查询系统,见下图
- 不成功登陆提示错误并返回,见下图
SUCCESS LOGIN
FAILURE LOGIN
3 程序源代码
login.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>loginPage</title>
</head>
<body bgcolor=AliceBlue >
<form name="loginForm" method="post" action="verify.jsp">
<center>
<font size=6>学生微教务</font>
</center>
<center>
<table>
<tr>
<td height="40" weight="100">UserName<input type="text" name="userName" id="userName"></td>
</tr>
<tr>
<td height="40" weight="100">Password<input type="password" name="password" id="password"></td>
</tr>
<tr>
<td><input type="submit" value="login" style="background-color:white"> <input type="reset" value="reset" style="background-color:yellow"></td>
</tr>
</table>
</center>
</form>
</body>
</html>verify.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Authentication</title>
</head>
<body>
<%
request.setCharacterEncoding("UTF-8");
String name = request.getParameter("userName");
String password = request.getParameter("password");
if(name.equals("14347119")&& password.equals("wuxing")) {
%>
<jsp:forward page="success.jsp">
<jsp:param name="userName" value="<%=name%>"/></jsp:forward>
<%}
else{
%>
<jsp:forward page="failure.jsp"></jsp:forward>
<%}
%>
</body>
</html>success.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Login Success</title>
</head>
<body bgcolor=AliceBlue>
<form name="SUCCESS" method="post" action="JMP.jsp">
<center>
<%request.setCharacterEncoding("UTF-8");
String name = request.getParameter("userName");
out.println("Welcome:"+name);%><BR>
</center>
<center>
<BR><font size="6">Score Query System</font><BR>
<BR><font size="4">Please select one item to check</font>
<Select name="grade" >
<Option selected value="http://wjw.sysu.edu.cn">Academic performance</option>
<Option value="http://cet.99sushe.com">CET-4 & CET-6</option>
<Option value="http://chaxun.neea.edu.cn/examcenter/query.cn?op=doQueryCond&pram=results&sid=300"> NCRE</option>
</Select>
<BR><BR> <Input type="submit" value="submit" name="submit">
</center>
</body>
</html>failure.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login Failure</title>
</head>
<body bgcolor="Aliceblue">
<center><font size="4">
Incorrect username or password! Please return and try again.
<BR><A href="login.jsp" >return
</font>
</center>
</body>
</html>JMP.JSP(用于跳转网站页面)
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JMP</title>
</head>
<body>
<% String s=request.getParameter("grade");
response.sendRedirect( s); %>
</body>
</html>
初学者:JSP登陆界面的更多相关文章
- jsp登陆界面代码
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncod ...
- 2017.10.20 jsp用户登陆界面连接数据库
用户登陆界面 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8 ...
- Eclipse通过jdbc连接数据库制作简单登陆界面
一.前言: 做网站开发,要求有多种搭配方式,前台技术可以使用PHP.ASP.JSP.ASP.NET.CGI等任何一种: 需要用到的基础语言用的最多的就是HTML/CSS.JS.JAVA.XML这些了, ...
- 🈲Eclipse通过jdbc连接数据库制作简单登陆界面【新手必看】
一.前言: 做网站开发,要求有多种搭配方式,前台技术可以使用PHP.ASP.JSP.ASP.NET.CGI等任何一种: 需要用到的基础语言用的最多的就是HTML/CSS.JS.JAVA.XML这些了, ...
- Android UI组件----用相对布局RelativeLayout做一个登陆界面
[声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/3 ...
- javaweb登陆界面实现不同角色进入不同界面
目录结构 类包: AccountBean.java AccountDao.java JudgeServlet.java 登陆界面: index.jsp 代码实现 AccountBean.java pa ...
- [Django]登陆界面以及用户登入登出权限
前言:简单的登陆界面展现,以及用户登陆登出,最后用户权限的问题 正文: 首先需要在settings.py设置ROOT_URLCONF,默认值为: ROOT_URLCONF = 'www.urls'# ...
- outlook 2016 for windows 每次刷新发送接收邮件会弹出登陆界面
Q: outlook2016 for windows 每次刷新发送接收邮件会弹出登陆界面,office365 ProPlus 都是正常激活了,Word 和Excel都不存在此类问题 A: 排除用户的o ...
- javafx之登陆界面的跳转
界面布局用到的是fxml而非纯java代码,工具是javafx sence builder 账号:account 密码:password 登陆成功: 可以点击退出登陆返回到登陆页面 工程目录: pac ...
随机推荐
- leetcode 111
题目描述: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along th ...
- 《30天自制操作系统》14_day_学习笔记
harib11a--harib11c: 继续测试性能:我们在harib10h中进行了定时链表结构的改进“消除了移位处理”.下面我们设定490个定时器(它们都被设定启动50天才超时)来测试一下改进的效果 ...
- 【转】PowerShell入门(七):管道——在命令行上编程
转至:http://www.cnblogs.com/ceachy/archive/2013/02/22/PowerShell_Pipeline.html 管道对于Shell来说是个化腐朽为神奇的东西, ...
- js计时器方法 setInterval(),setTimeout()
window.setInterval() 周期性地调用一个函数(function)或者执行一段代码. var intervalID = window.setInterval(func, delay[, ...
- Tomcat配置文件之servlet.xml中选项介绍
Servlet.xml 分为以下元素: server, service, Connector ( 表示客户端和service之间的连接), Engine ( 表示指定service 中的请求处理机,接 ...
- [转]关于NSAutoreleasePool' is unavailable: not available in automatic reference counting mode的解决方法
转载地址:http://blog.csdn.net/xbl1986/article/details/7216668 Xcode是Version 4.2 Build 4D151a 根据Objective ...
- 用NULL布局为什么不能显示
import javax.swing.JComboBox;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing. ...
- Ajax jsonp
http://blog.csdn.net/superhosts/article/details/9057301
- GZFramwork快速开发框架演练之会员系统(四)添加商品管理
1.1:创建表结构 新建三张商品关联的表,表模型如下: 创建SQL语句略 1.2:生成表Model(生成方法见上一节) 1.3:生成tb_ProductType的单结构界面然后添加到项目中 1.4:修 ...
- Android学习简单总结
1: 主要的view控件: 文字: TextView 图片: ImgView 视频:SurfaceView ... 2:控件 PopupWindow 实现类似左边导航栏 tabhost实现顶部或者下部 ...