初学者: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 ...
随机推荐
- 【转】ubuntu 重启命令,ubuntu 重启网卡方法
ubuntu 重启命令 重启命令:1.reboot2.shutdown -r now 立刻重启(root用户使用)3.shutdown -r 10 过10分钟自动重启(root用户使用)4.shutd ...
- 浏览器浏览记忆(history)几则技巧记录
一般浏览记录模式 假设有三个页面, start.html, 通过点击start.html上的链接跳转到 first.html, 然后点击first.html上链接跳转到 second.html, 那么 ...
- Form 数据库的顺序
form buidler 中数据库的上下排列顺序也很重要,开发中无心把LINE的数据块放在HEADER数据块之上, 导致在新增数据的时候先去insert LINE数据块(没有生成HEADER_ID的 ...
- SQL中的charindex函数与reverse函数用法
----------------------首先介绍charindex函数----------------------------- ...
- Codeforces 749C:Voting(暴力模拟)
http://codeforces.com/problemset/problem/749/C 题意:有n个人投票,分为 D 和 R 两派,从1~n的顺序投票,轮到某人投票的时候,他可以将对方的一个人K ...
- Web Server 配置及上传文件
第一种方案:从github上面克隆到服务器 1.git上传文件 ( git bash ) ①切换至所要上传的文件夹 cd 文件夹homepage ②告诉系统当前文件夹要进行git管理 git init ...
- LA 3523 圆桌骑士
题目链接:http://vjudge.net/contest/141787#problem/A http://poj.org/problem?id=2942 此题很经典 知识点:DFS染色,点-双连通 ...
- java并发编程参考资料
1.java编程思想 2.java并发编程实战 3.java并发编程的艺术 4.http://www.infoq.com/cn/author/%E7%A8%8B%E6%99%93%E6%98%8E#文 ...
- selenium操作H5视频
测试网址:http://www.w3school.com.cn/tiy/loadtext.asp?f=html5_video_simplepackage com.allin.pc;import jav ...
- ggplot2.multiplot:将多个图形使用GGPLOT2在同一页上
一页多图 介绍 ggplot2.multiplot是一个易于使用的功能,将多个图形在同一页面上使用R统计软件和GGPLOT2绘图方法.这个功能是从easyGgplot2包. 安装并加载easyGgpl ...