addInput.jsp
<%@page import="com.jaovo.msg.Util.ValidateUtil"%>
<%@page import="java.util.Map"%>
<%@ 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>用户添加页面</title>
</head>
<body>
<%-- <%Map<String,String> errorMsg = (Map<String,String>)request.getAttribute("errorMsg"); --%>
<%-- %> --%>
<form action="add.jsp" method="get">
<table align="center" border="1" width="500">
<tr>
<td>课程名称 : </td>
<td>
<input type="text" name="name" />
<%
// if(errorMsg != null){
// if(errorMsg.get("name") != null){
// out.println( errorMsg.get("name"));
// }
// }
%>
<%=ValidateUtil.showError(request, "name") %>
</td>
</tr>
<tr>
<td>上课时间:</td>
<td>
<input type="text" name="time" />
<%
// if(errorMsg != null){
// if(errorMsg.get("time") != null){
// out.println( errorMsg.get("time"));
// }
// }
%>
<%=ValidateUtil.showError(request, "time") %>
</td>
</tr>
<tr>
<td>课程节次:</td>
<td>
<input type="text" name="jieci" />
<%
// if(errorMsg != null){
// if(errorMsg.get("jieci") != null){
// out.println( errorMsg.get("jieci"));
// }
// }
%>
<%=ValidateUtil.showError(request, "jieci") %>
</td>
</tr>
<tr>
<td>所属学院:</td>
<td>
<input type="text" name="college" />
<%
// if(errorMsg != null){
// if(errorMsg.get("college") != null){
// out.println( errorMsg.get("college"));
// }
// }
%>
<%=ValidateUtil.showError(request, "college") %>
</td>
</tr>
<tr>
<td>教师工号:</td>
<td>
<input type="text" name="tid" />
<%
// if(errorMsg != null){
// if(errorMsg.get("tid") != null){
// out.println( errorMsg.get("tid"));
// }
// }
%>
<%=ValidateUtil.showError(request, "tid") %>
</td>
</tr>
<tr>
<td>教师姓名:</td>
<td>
<input type="text" name="tname" />
<%
// if(errorMsg != null){
// if(errorMsg.get("tname") != null){
// out.println( errorMsg.get("tname"));
// }
// }
%>
<%=ValidateUtil.showError(request, "tname") %>
</td>
</tr>
<tr>
<td>限制人数:</td>
<td>
<input type="text" name="number" />
<%
// if(errorMsg != null){
// if(errorMsg.get("number") != null){
// out.println( errorMsg.get("number"));
// }
// }
%>
<%=ValidateUtil.showError(request, "number") %>
</td>
</tr>
<tr align="center">
<td colspan="2">
<input type="submit" value="提交" />
<input type="reset" value="重置" />
</td>
</tr>
</table>
</form>
</body>
</html>
<%@page import="java.util.Map"%>
<%@ 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>用户添加页面</title>
</head>
<body>
<%-- <%Map<String,String> errorMsg = (Map<String,String>)request.getAttribute("errorMsg"); --%>
<%-- %> --%>
<form action="add.jsp" method="get">
<table align="center" border="1" width="500">
<tr>
<td>课程名称 : </td>
<td>
<input type="text" name="name" />
<%
// if(errorMsg != null){
// if(errorMsg.get("name") != null){
// out.println( errorMsg.get("name"));
// }
// }
%>
<%=ValidateUtil.showError(request, "name") %>
</td>
</tr>
<tr>
<td>上课时间:</td>
<td>
<input type="text" name="time" />
<%
// if(errorMsg != null){
// if(errorMsg.get("time") != null){
// out.println( errorMsg.get("time"));
// }
// }
%>
<%=ValidateUtil.showError(request, "time") %>
</td>
</tr>
<tr>
<td>课程节次:</td>
<td>
<input type="text" name="jieci" />
<%
// if(errorMsg != null){
// if(errorMsg.get("jieci") != null){
// out.println( errorMsg.get("jieci"));
// }
// }
%>
<%=ValidateUtil.showError(request, "jieci") %>
</td>
</tr>
<tr>
<td>所属学院:</td>
<td>
<input type="text" name="college" />
<%
// if(errorMsg != null){
// if(errorMsg.get("college") != null){
// out.println( errorMsg.get("college"));
// }
// }
%>
<%=ValidateUtil.showError(request, "college") %>
</td>
</tr>
<tr>
<td>教师工号:</td>
<td>
<input type="text" name="tid" />
<%
// if(errorMsg != null){
// if(errorMsg.get("tid") != null){
// out.println( errorMsg.get("tid"));
// }
// }
%>
<%=ValidateUtil.showError(request, "tid") %>
</td>
</tr>
<tr>
<td>教师姓名:</td>
<td>
<input type="text" name="tname" />
<%
// if(errorMsg != null){
// if(errorMsg.get("tname") != null){
// out.println( errorMsg.get("tname"));
// }
// }
%>
<%=ValidateUtil.showError(request, "tname") %>
</td>
</tr>
<tr>
<td>限制人数:</td>
<td>
<input type="text" name="number" />
<%
// if(errorMsg != null){
// if(errorMsg.get("number") != null){
// out.println( errorMsg.get("number"));
// }
// }
%>
<%=ValidateUtil.showError(request, "number") %>
</td>
</tr>
<tr align="center">
<td colspan="2">
<input type="submit" value="提交" />
<input type="reset" value="重置" />
</td>
</tr>
</table>
</form>
</body>
</html>
delete.jsp
<%@page import="com.jaovo.msg.Util.DaoFactory"%>
<%@page import="com.jaovo.msg.dao.UserDaoImpl"%>
<%@ 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">
<%
int id = Integer.parseInt(request.getParameter("id"));
//工厂模式
UserDaoImpl userDao = DaoFactory.getDaoImpl();
userDao.delete(id);
response.sendRedirect("./index.jsp");
%>
<%@page import="com.jaovo.msg.dao.UserDaoImpl"%>
<%@ 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">
<%
int id = Integer.parseInt(request.getParameter("id"));
//工厂模式
UserDaoImpl userDao = DaoFactory.getDaoImpl();
userDao.delete(id);
response.sendRedirect("./index.jsp");
%>