1<%@ page language="java" contentType="text/html; charset=GB18030"
  2    pageEncoding="GB18030"
%>
  3<%@ taglib prefix="bean"  uri="http://struts.apache.org/tags-bean" %>
  4<%@ taglib prefix="logic"  uri="http://struts.apache.org/tags-logic" %>   
  5<html>
  6    <head>
  7        <meta http-equiv="Content-Type" content="text/html; charset=GB18030">
  8        <title>用户维护</title>
  9        <link rel="stylesheet" href="../style/drp.css">
 10        <script type="text/javascript">
 11    
 12    function addUser() {
 13        window.self.location = "user_input.jsp";    
 14    }

 15    
 16    function modifyUser() {
 17        var count = 0;
 18        var j = 0;
 19        for (var i = 0; i < document.getElementsByName("selectFlag").length; i++{
 20            if (document.getElementsByName("selectFlag")[i].checked) {
 21                j = i;
 22                count++;
 23            }

 24        }

 25        if (count == 0{
 26            alert("请选择需要修改的用户!");
 27            return;
 28        }

 29        if (count > 1{
 30            alert("一次只能修改一个用户!");
 31            return;
 32        }

 33        if (count == 1{
 34            window.self.location = "find.do?userId=" + document.getElementsByName("selectFlag")[j].value;
 35        }

 36    }

 37    
 38    function deleteUser() {
 39        var flag = false;
 40        for (var i = 0; i < document.getElementsByName("selectFlag").length; i++{
 41            if (document.getElementsByName("selectFlag")[i].checked) {
 42                flag = true;
 43            }
        
 44        }

 45        if (!flag) {
 46            alert("请选择需要删除的用户!");
 47            return;
 48        }

 49        if (window.confirm("确认删除吗?")) {
 50            with (document.getElementById("userForm")) {
 51                method = "post";
 52                action = "del.do";
 53                submit();
 54            }

 55        }

 56    }

 57        
 58    function checkAll() {
 59        for (var i = 0; i < document.getElementsByName("selectFlag").length; i++{
 60            document.getElementsByName("selectFlag")[i].checked = document.getElementById("ifAll").checked;
 61        }

 62    }

 63
 64
</script>
 65    </head>
 66
 67    <body class="body1">
 68        <form name="userform" id="userform">
 69            <div align="center">
 70                <table width="95%" border="0" cellspacing="0" cellpadding="0"
 71                    height="35">
 72                    <tr>
 73                        <td class="p1" height="18" nowrap>
 74                            &nbsp;
 75                        </td>
 76                    </tr>
 77                    <tr>
 78                        <td width="522" class="p1" height="17" nowrap>
 79                            <img src="../images/mark_arrow_02.gif" width="14" height="14">
 80                            &nbsp;
 81                            <b>系统管理&gt;&gt;用户维护</b>
 82                        </td>
 83                    </tr>
 84                </table>
 85                <hr width="100%" align="center" size=0>
 86            </div>
 87            <table width="95%" height="20" border="0" align="center"
 88                cellspacing="0" class="rd1" id="toolbar">
 89                <tr>
 90                    <td width="49%" class="rd19">
 91                        <font color="#FFFFFF">查询列表</font>
 92                    </td>
 93                    <td width="27%" nowrap class="rd16">
 94                        <div align="right"></div>
 95                    </td>
 96                </tr>
 97            </table>
 98            <table width="95%" border="1" cellspacing="0" cellpadding="0"
 99                align="center" class="table1">
100                <tr>
101                    <td width="55" class="rd6">
102                        <input type="checkbox" name="ifAll" onClick="checkAll()">
103                    </td>
104                    <td width="119" class="rd6">
105                        用户代码
106                    </td>
107                    <td width="152" class="rd6">
108                        用户名称
109                    </td>
110                    <td width="166" class="rd6">
111                        联系电话
112                    </td>
113                    <td width="150" class="rd6">
114                        email
115                    </td>
116                    <td width="153" class="rd6">
117                        创建日期
118                    </td>
119                </tr>
120                <logic:empty name="userlist">
121                <tr>
122                    <td class="rd8" colspan="6">
123                        <font color="red">没有符合条件的数据</font>
124                    </td>
125                </tr>    
126                </logic:empty>
127                <logic:notEmpty name="userlist">
128                    <logic:iterate id="user" name="userlist">
129                        <tr>
130                            <td class="rd8">
131                                <input type="checkbox" name="selectFlag" class="checkbox1"
132                                    value="<bean:write name="user" property="userId"/>">
133                            </td>
134                            <td class="rd8">
135                                <bean:write name="user" property="userId" />
136                            </td>
137                            <td class="rd8">
138                                <bean:write name="user" property="userName" />
139                            </td>
140                            <td class="rd8">
141                                <bean:write name="user" property="contactTel" />
142                            </td>
143                            <td class="rd8">
144                                <bean:write name="user" property="email" />
145                            </td>
146                            <td class="rd8">
147                                <bean:write name="user" property="createDate" format="yyyy-MM-dd HH:mm:ss" />
148                            </td>
149                        </tr>
150                    </logic:iterate>
151                </logic:notEmpty>
152            </table>
153            <table width="95%" height="30" border="0" align="center"
154                cellpadding="0" cellspacing="0" class="rd1">
155                <tr>
156                    <td nowrap class="rd19" height="2">
157                        <div align="left">
158                            <font color="#FFFFFF">&nbsp;&nbspxx&nbsp</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
159                            <font color="#FFFFFF">当前第</font>&nbsp
160                            <font color="#FF0000">x</font>&nbsp
161                            <font color="#FFFFFF"></font>
162                        </div>
163                    </td>
164                    <td nowrap class="rd19">
165                        <div align="right">
166                            <input name="btnAdd" type="button" class="button1" id="btnAdd"
167                                value="添加" onClick="addUser()">
168                            <input name="btnDelete" class="button1" type="button"
169                                id="btnDelete" value="删除" onClick="deleteUser()">
170                            <input name="btnModify" class="button1" type="button"
171                                id="btnModify" value="修改" onClick="modifyUser()">
172                        </div>
173                    </td>
174                </tr>
175            </table>
176            <p>
177                &nbsp;
178            </p>
179        </form>
180    </body>
181</html>
182