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