<%@page contentType="text/html;charset=gb2312"%>
<%@ taglib uri="/struts-logic" prefix="logic" %>
<%@ taglib uri="/struts-bean" prefix="bean" %>
<%@ taglib uri="/struts-html" prefix="html" %>
<%@ taglib uri="/jstl/c" prefix="c" %>
<jsp:useBean id="departmentBean" class="com.jspdev.ch17.DepartmentBean" scope="session"/>
<c:set var="departments" value="${departmentBean.departments}"/>
<html:html locale="true">
<head>
<link href="<html:rewrite page="/rr.css" />" rel="stylesheet" type="text/css">
<title>查看所有的部门</title>
</head>
<body>
<center>
<h1>以下是系统的所有部门：</h1>

<logic:messagesPresent>
    <span id="errorsHeader"><bean:message key="errors.validation.header"/></span>
    <html:messages id="error">
      <li><c:out value="${error}"/></li>
    </html:messages>
    <hr>
</logic:messagesPresent>
 <html:errors/>
   <table align="center" bgcolor="#008800" border="0" cellspacing="2" cellpadding="5">
         <tr bgcolor="#cccccc"> 
         <td><b>部门ID</b></td> 
         <td><b>部门名称 </b></td>  
         <td><b>部门领导 </b></td> 
         <td><b>增加员工 </b></td> 
         <td><b>删除员工 </b></td> 

         </tr>
       <logic:iterate id="depts" name="departments" >
	  <tr bgcolor="#FFFF88">
	  <td>
          <bean:write name="depts" property="id" /></td>
         <td>
          <bean:write name="depts" property="name" /></td>
           <td>
          <bean:write name="depts" property="leader" /></td>
          <td><html:link page="/employee/addEmployeeToDept.jsp" paramId="deptId" paramName="depts" paramProperty="id">添加</html:link></td>
          <td><html:link page="/employee/deleteEmployeeFromDept.jsp" paramId="deptId" paramName="depts" paramProperty="id">删除</html:link></td>
        </tr>
        </logic:iterate>
     </table>
</center>
</body>
</html:html>