EL和JSTL改造简单oa项目

用EL和JSTL改造简单oa项目代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>新增部门</title>
</head>
<body>
<h1>新增部门</h1>
<hr>
<form action="${pageContext.request.contextPath}/add" method="post">
部门编号<input type="text" name="deptno"/><br>
部门名称<input type="text" name="dname"/><br>
部门位置<input type="text" name="loc"/><br>
<input type="submit" value="保存">
</form>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>部门详情</title>
</head>
<body>
<h1>部门详情</h1>
<hr>
部门编号<input type="text" value="${dept.deptno}" readonly/><br>
部门名称<input type="text" value="${dept.dname}" readonly/><br>
部门位置<input type="text" value="${dept.loc}" readonly/><br>
<input type="button" value="后退" onclick="window.history.back()">
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>修改部门</title>
</head>
<body>
<h1>修改部门</h1>
<hr>
<form action="${pageContext.request.contextPath}/modify" method="post">
部门编号<input type="text" name="deptno" value="${dept.deptno}" readonly/><br>
部门名称<input type="text" name="dname" value="${dept.dname}"/><br>
部门位置<input type="text" name="loc" value="${dept.loc}"/><br>
<input type="submit" value="修改">
</form>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>操作或登录失败</title>
</head>
<body>
<h1><a href="javascript:void(0)" onclick="document.location.href='${pageContext.request.contextPath}/welcome'">操作或登录失败请返回起始页</a></h1>

</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>欢迎使用OA系统</title>
</head>
<body>
<%--<a href="<%=request.getContextPath()%>/list">点击进入部门列表</a><br>--%>
<h1>用户登录</h1>
<hr>
<form action="${pageContext.request.contextPath}/login" method="post">
用户名:<input type="text" name="userName"/><br>
密码:<input type="password" name="userPassword"><br>
<input type="checkbox" name="flag" value="1">十天内免登录<br>
<input type="submit" value="登录">
</form>

</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<title>部门列表</title>
<script>
function del(deptno){
if(window.confirm('请确认是否删除!')){
document.location.href='${pageContext.request.contextPath}/delete?deptno='+deptno;
}
}
</script>
</head>
<body>
<h3>欢迎${userName}</h3><br>
<a href="${pageContext.request.contextPath}/logout">[退出系统]</a>
<a href="${pageContext.request.contextPath}/freeLogin">[退出免登陆状态]</a>
<h1 align="center">部门列表</h1>
<hr>
<table border="1px" align="center" width="50%">
<tr>
<th>序号</th>
<th>部门编号</th>
<th>部门名称</th>
<th>操作</th>
</tr>
<c:forEach items="${deptList}" varStatus="varStatus" var="dept">
<tr>
<td>${varStatus.count}</td>
<td>${dept.deptno}</td>
<td>${dept.dname}</td>
<td>
<a href="javascript:void(0)" onclick="del(${dept.deptno})">删除</a>
<a href="${pageContext.request.contextPath}/detail?f=m&deptno=${dept.deptno}">修改</a>
<a href="${pageContext.request.contextPath}/detail?f=d&deptno=${dept.deptno}">详情</a>
</td>
</tr>
</c:forEach>
</table>
<hr>
<a href="${pageContext.request.contextPath}/add.jsp">新增部门</a><br>
<a href="${pageContext.request.contextPath}/index.jsp">回到起始页</a>
</body>
</html>