基于S2H的学生、班级管理小项目

/day_0607_02/WebContent/loginCheck/view.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
   pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>管理学生页面</title>
<style type="text/css">
body{
	position: relative;
}
form{
	text-align: center;
	font-weight: bolder;
}
input{
	border: 1px solid #000; 
}
table {
	width: 75%;
	margin:auto;
	padding:1px;
	text-align:center;
	border-collapse: collapse;
}

.even{
	background:salmon; 
}
.odd{
	background: #99FFFF;
}
a {  
    border: 1px solid #000;  
    padding: 0 7px;  
    text-decoration: none; 
    background:buttonhighlight; 
}  
</style>

<script type="text/javascript">
function addStudent() {
	document.demo.action = "loginView.jsp";
	document.demo.submit();
}
</script>
</head>
<body>
	<form action="${pageContext.request.contextPath}/StudentAction" method="post" name="demo">
		用户名:<input type="text" name="studentName" />
		<input type="hidden" value="readStudent" name="hidden">
		<input type="submit" value="查询" style="font-weight: bolder">
		<input type="button" value="添加" style="font-weight: bolder" οnclick="addStudent()">
	</form><br>
	<table border="1px">
		<tr style="background: inactivecaptiontext">
			<th>学号</th>
			<th>姓名</th>
			<th>性别</th>
			<th>出生日期</th>
			<th>班级Id</th>
			<th>班级名称</th>
			<th>开班日期</th>
			<th>修改</th>
			<th>删除</th>
		</tr>
		<s:iterator value="#session.studentList" var="student" status="st">
		<tr class='<s:property value="#st.even == true?'even':'odd'"/>'>
			<td><s:property value="#student.studentId" /></td>
			<td><s:property value="#student.studentName" /></td>
			<td><s:property value="#student.studentSex" /></td>
			<td><s:property value="#student.studentBirth" /></td>
			<td><s:property value="#student.grade.gradeId" /></td>
			<td><s:property value="#student.grade.gradeName" /></td>
			<td><s:property value="#student.grade.gradeBirth" /></td>
			<td><a href="<s:url value="loginView.jsp"/>">修改</a></td>
			<td><a href="<s:url value="loginView.jsp"/>">删除</a></td>
		</tr>
		</s:iterator>
	</table>
</body>
</html>

/day_0607_02/WebContent/loginCheck/loginView.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>更新页面</title>
</head>
<body>
	<h3>更新页面</h3>
	<s:form namespace="/loginCheck" action="login.action" method="post">
		<s:textfield name="student.studentId" label="学号" />
		<s:textfield name="student.studentName" label="姓名" />
		<s:radio name="student.studentSex" list="#{'1':'男','0':'女'}"
			label="性别" />
		<s:select name="student.studentBirth" label="出生日期"
			headerValue="请选择出生日期" headerKey=""
			list="#{'1995-06-07':'1995-06-07','1996-06-07':'1996-06-07','1997-06-07':'1997-06-07'}" />
		<s:submit value="更新学生" method="checkStudent" />
		<s:submit value="取消更新" method="checkStudent" />
	</s:form>
	<s:actionmessage />
</body>
</html>

结果

说明

由于代码太多,就不粘贴了,下载地址:点击打开链接

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值