📄
字号:
范例User_update.jsp源代码:
001 <%@ page errorPage="ErrPage.jsp"
002 import="Java.util.Date, Java.sql.*"
003 contentType="text/html;charset=gb2312"%>
004 <JSP:useBean id="pool" scope="application" class="com.PoolBean"/>
005 <%
006 String strLoginUser = (String)session.getAttribute("LoginUser");
007 if (strLoginUser == null || strLoginUser.length() == 0)
008 response.sendRedirect("Login.jsp");
009 %>
010 <HTML>
011 <HEAD>
012 <SCRIPT LANGUAGE="JavaScript" SRC="meeting.js"></SCRIPT>
013 <script language="JavaScript" type="text/Javascript">
014 <!--
015 function isok(theform)
016 {
017 if (theform.user_password.value=="")
018 {
019 alert("请您填写用户密码!");
020 theform.user_password.focus();
021 return (false);
022 }
023 var user_password =theform.user_password.value;
024 var confirm_password =theform.confirm_password.value;
025 if (!(user_password==confirm_password))
026 {
027 alert("您填入的密码不一致,请重新输入!");
028 theform.user_password.value="";
029 theform.confirm_password.value="";
030 theform.user_password.focus();
031 return (false);
032 }
033 if (theform.user_sex.value=="")
034 {
035 alert("请您选择性别!");
036 return (false);
037 }
038 if (theform.user_year.value=="")
039 {
040 alert("请您填写出生日期的年份!");
041 theform.user_year.focus();
042 return (false);
043 }
044 var getformyear;
045 getformyear= theform.user_year.value;
046 var int_year= isintnumber(getformyear);
047 if (!int_year)
048 {
049 alert("您填入的出生日期中的年有错误!");
050 return false;
051 }
052 var getformmonth;
053 getformmonth = theform.user_month.value;
054 var getformday;
055 getformday = theform.user_day.value;
056 var subreturndate;
057 subreturndate=0;
058 subreturndate = isrightdate(getformyear,getformmonth,getformday);
059 if (subreturndate == 1)
060 {
061 alert(getformyear+"年"+getformmonth+"月只有三十天,请您重新填写日期!");
062 return false;
063 }
064 if (subreturndate == 2)
065 {
066 alert(getformyear+"年二月只有29天,请您重新填写日期!");
067 return false;
068 }
069 if (subreturndate == 3)
070 {
071 alert(getformyear+"年二月只有28天,请您重新填写日期!");
072 return false;
073 }
074 if (theform.user_duty.value=="")
075 {
076 alert("请您填写职称或职务!");
077 theform.user_duty.focus();
078 return (false);
079 }
080 if (theform.user_workplace.value=="")
081 {
082 alert("请您填写工作单位!");
083 theform.user_workplace.focus();
084 return (false);
085 }
086 if (theform.user_address.value=="")
087 {
088 alert("请您填写通信地址!");
089 theform.user_address.focus();
090 return (false);
091 }
092 if (theform.user_tel.value=="")
093 {
094 alert("请您填写联系电话!");
095 theform.user_tel.focus();
096 return (false);
097 }
098 if (theform.user_email.value=="")
099 {
100 alert("请您填写电子箱信地址!");
101 theform.user_email.focus();
102 return (false);
103 }
104 return (true);
105 }
106 function onClick()
107 {
108 this.location.replace("default.jsp");
109 }
110 -->
111 </script>
112 <LINK REL="stylesheet" HREF="littleproject.css" TYPE="text/css">
113 <TITLE>用户信息更改</TITLE>
114 </HEAD>
115 <BODY bgcolor=LightBlue>
116 <%
117 try
118 {
119 String user_code="",user_name="",user_password="",user_sex="";
120 String user_birthday="",user_year="",user_email="";
121 String user_month="",user_day="",user_duty="",user_workplace="";
122 String user_tel="",user_address="";
123 if (pool.getConnectionSize() == 0)
124 {
125 pool.initializePool();
126 }
127 Connection con = null;
128 Statement stmt = null;
129 con = pool.getConnection();
130 stmt= con.createStatement();
131 ResultSet rs=null;
132
133 String strSel = "select * from user where code='"+strLoginUser+"'" ;
134 rs = stmt.executeQuery(strSel);
135 while (rs.next())
136 {
137 user_password=rs.getString("password");
138 user_sex=rs.getString("sex");
139 user_birthday=rs.getString("birthday");
140 user_duty=rs.getString("duty");
141 user_workplace=rs.getString("workplace");
142 user_address=rs.getString("address");
143 user_tel=rs.getString("telephone");
144 user_email=rs.getString("email");
145 }
146 %>
147 <center>
148 <font size="5" face="隶书">用户信息更改</font><br><br>
149 <form action="User_updateext.jsp" method=POST onsubmit="return isok(this)">
150 <TABLE border=1 bordercolor=RoyalBlue bgcolor=LightBlue width=400>
151 <tr>
152 <TD width=100 align=center>密 码</TD>
153 <TD width=300 align=left>
154 <input type="password" size="30" name="user_password"
155 value="<%= user_password %>"
156 style="border-style: solid; border-width: 1">
157 </TD>
158 </tr>
159 <tr>
160 <TD width=100 align=center>密码确认</TD>
161 <TD width=300 align=left>
162 <input type="password" size="30" name="confirm_password"
163 value="<%= user_password %>" style="border-style: solid; border-width: 1">
164 </TD>
165 </tr>
166 <tr>
167 <TD width=100 align=center>性 别</TD>
168 <TD width=300 align=left>
169 <%
170 if (user_sex.equals("m"))
171 {
172 %>
173 <input type="radio" name="user_sex" value="m" checked>男
174 <input type="radio" name="user_sex" value="f">女
175 <%
176 }
177 else
178 {
179 %>
180 <input type="radio" name="user_sex" value="m">男
181 <input type="radio" name="user_sex" value="f" checked>女
182 <%
183 }
184 %>
185 </TD>
186 </tr>
187 <tr>
188 <TD width=100 align=center>出年日期</TD>
189 <TD width=300 align=left>
190 <input type="text" size="7" name="user_year"
191 value="<%=user_birthday.substring(0,4)%>"
192 style="border-style: solid; border-width: 1">年
193 <select name="user_month" size="1">
194 <option value="<%=user_birthday.substring(5,7)%>">
195 <%=user_birthday.substring(5,7)%>
196 </option>
197 <%
198 for (int i=0; i<10;i++)
199 {
200 %>
201 <option value="0<%=i+1%>"><%=i+1%></option>
202 <%
203 }
204 for (int i=10; i<12;i++)
205 {
206 %>
207 <option value="<%=i+1%>"><%=i+1%></option>
208 <%
209 }
210 %>
211 </select>月
212 <select name="user_day" size="1">
213 <option value="<%=user_birthday.substring(8,10)%>">
214 <%=user_birthday.substring(8,10)%>
215 </option>
216 <%
217 for (int j=1; j<10;j++)
218 {
219 %>
220 <option value="0<%=j%>"><%=j%></option>
221 <%
222 }
223 for (int j=10; j<32;j++)
224 {
225 %>
226 <option value="<%=j%>"><%=j%></option>
227 <%
228 }
229 %>
230 </select>日
231 </TD>
232 </tr>
233 <tr>
234 <TD width=100 align=center>职 务</TD>
235 <TD width=300 align=left>
236 <input type="text" size="30" name="user_duty" value="<%= user_duty %>"
237 style="border-style: solid; border-width: 1">
238 </TD>
239 </tr>
240 <tr>
241 <TD width=100 align=center>工作单位</TD>
242 <TD width=300 align=left>
243 <input type="text" size="40" name="user_workplace"
244 value="<%= user_workplace %>"
245 style="border-style: solid; border-width: 1">
246 </TD>
247 </tr>
248 <tr>
249 <TD width=100 align=center>通信地址</TD>
250 <TD width=300 align=left>
251 <input type="text" size="40"
252 name="user_address" value="<%=user_address%>"
253 style="border-style: solid; border-width: 1">
254 </TD>
255 </tr>
256 <tr>
257 <TD width=100 align=center>联系电话</TD>
258 <TD width=300 align=left>
259 <input type="text" size="40"
260 name="user_tel" value="<%=user_tel %>"
261 style="border-style: solid; border-width: 1">
262 </TD>
263 </tr>
264 <tr>
265 <TD width=100 align=center>邮件地址</TD>
266 <TD width=300 align=left>
267 <input type="text" size="40" name="user_email"
268 value="<%=user_email %>" style="border-style: solid; border-width: 1">
269 </TD>
270 </tr>
271 </TABLE>
272 <input type="submit" value="更 改">
273 <input type="reset" value="取 消">
274 <input type="button" onClick="onClick()" value="退 出">
275 </form>
276 </CENTER>
277 <%
278 stmt.close();//关闭Statement对象
279 pool.releaseConnection(con);
280 }
281 catch(Exception e)
282 {
283 System.out.println("Exception: " + e.getMessage());
284 }
285 %>
286 </BODY>
287 </HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -