Struts2+Hibernate

功能及要求

使用Struts 2+Hibernate实现一个简单的模型
JSP+ Struts 2 +Hibernate+数据库
要求:
1、完成注册、登录、退出三个功能
2、注册校验用框架实现
3、使用Struts标签库
4、实现过滤器
(1)只能登陆成功后才能访问主页面。
5、实现拦截器功能。
(1)实现黑名单功能
6、实现文件上传功能

结构

在这里插入图片描述

登录页面 login.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>登录页面</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
</head>

<body>
	<div align="right">
		<s:a href="http://localhost:8080/StrutsTest/register.jsp">
			<font color="blue"><h5>还未注册?点击注册</h5> </font>
		</s:a>
	</div>

	<div align="left">
		<h1 align="left">登录</h1>
		<s:fielderror cssStyle="color:red"></s:fielderror>
		<s:actionerror cssStyle="color:red"></s:actionerror>
		<br>
		<s:form action="login" theme="simple" method="post" validate="true">
			<table border="0" style="width: 220px; height: 200px;">
				<tr>
					<td>用户名:</td>
					<td width=20><s:textfield name="username"></s:textfield></td>
				</tr>

				<tr>
					<td>密码:</td>
					<td><s:password name="password"></s:password>
					</td>
				</tr>

				<tr>
					<td align="center"><s:submit value="登录"></s:submit>
					</td>
					<td align="center"><s:reset value="重置"></s:reset></td>
				</tr>

			</table>
		</s:form>
	</div>
</body>
</html>

注册页面register.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>注册页面</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

</head>

<body>
	<h1 align="center">注册</h1>
	<div align="center">
		<s:fielderror cssStyle="color:red"></s:fielderror>
		<s:actionerror cssStyle="color:red"></s:actionerror>
		<br>
		<s:form action="register" theme="simple" method="post" validate="true">
			<table width="50%" border="0" style="width: 501px; height: 342px;">
				<tr>
					<td align="right">用户名:</td>
					<td width=20><s:textfield name="username"></s:textfield></td>
					<td><font color="red" align="left"><h6>*必填</h6> </font></td>
				</tr>

				<tr>
					<td align="right">密码:</td>
					<td><s:password name="password"></s:password></td>
					<td><font color="red" align="left"><h6>*必填</h6> </font></td>
				</tr>

				<tr>
					<td align="right">确认密码:</td>
					<td><s:password name="repassword"></s:password></td>
					<td><font color="red" align="left"><h6>*必填</h6> </font></td>
				</tr>

				<tr>
					<td align="right">电子邮箱:</td>
					<td><s:textfield name="email"></s:textfield></td>
					<td><font color="red" align="left"><h6>*必填</h6> </font></td>
				</tr>		

				<tr>
					<td></td>
					<td><s:submit value="提交"></s:submit> <s:reset value="重置"></s:reset>
					</td>
				</tr>
				
			</table>
		</s:form>
	</div>
</body>
</html>

注册成功页面 register_success.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'register_success.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
  • 0
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值