首先看下我们需要做哪些功能
需要建立的包和类
建立三个表
学生表,老师表,班级表
index界面的代码
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!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>Insert title here</title>
<style type="text/css">
table,tr{
border-collapse: collapse;
}
td{
text-align: center;}
</style>
</head>
<body>
<h3 align="center"><a href="add.jsp">点我新增学生</a></h3>
<table border="" width="1000px" height="400px" align="center">
<tr><td colspan="6">
<form action="mh.do">
教员:<select name="tea">
<option value="null">--请选择教员--</option>
<c:forEach var="t" items="${list2 }">
<option value="${t.tname }" ${t.tname==tea?"selected":"" }></option>
</c:forEach>
</select>
班级:<select name="cla">
<option value="null">--请选择班级--</option>
<c:forEach var="b" items="${list1 }">
<option value="${b.cclass }" ${b.cclass==cla?"selected":"" }></option>
</c:forEach>
</select>
爱好:
<input type="checkbox" name="sah" value="吃饭" <c:forEach var="i" items="${ ah }">
<c:if test="${ i=='吃饭' }"> checked
</c:if>
</c:forEach>>吃饭
<input type="checkbox" name="sah" value="睡觉" <c:forEach var="i" items="${ ah }">
<c:if test="${ i=='睡觉' }"> checked
</c:if>
</c:forEach>>睡觉
<input type="checkbox" name="sah" value="游戏" <c:forEach var="i" items="${ ah }">
<c:if test="${ i=