📄 user_update.jsp
字号:
<%@ page errorPage="ErrPage.jsp"
import="java.util.Date, java.sql.*,com.PoolBean"
contentType="text/html;charset=gb2312"%>
<JSP:useBean id="pool" scope="application" class="com.PoolBean"/>
<%
String strLoginUser = (String)session.getAttribute("LoginUser");
if (strLoginUser == null || strLoginUser.length() == 0)
response.sendRedirect("Login.jsp");
%>
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript" SRC="meeting.js"></SCRIPT>
<script language="JavaScript" type="text/Javascript">
<!--
function isok(theform)
{
if (theform.user_password.value=="")
{
alert("请您填写用户密码!");
theform.user_password.focus();
return (false);
}
var user_password =theform.user_password.value;
var confirm_password =theform.confirm_password.value;
if (!(user_password==confirm_password))
{
alert("您填入的密码不一致,请重新输入!");
theform.user_password.value="";
theform.confirm_password.value="";
theform.user_password.focus();
return (false);
}
if (theform.user_sex.value=="")
{
alert("请您选择性别!");
return (false);
}
if (theform.user_year.value=="")
{
alert("请您填写出生日期的年份!");
theform.user_year.focus();
return (false);
}
var getformyear;
getformyear= theform.user_year.value;
var int_year= isintnumber(getformyear);
if (!int_year)
{
alert("您填入的出生日期中的年有错误!");
return false;
}
var getformmonth;
getformmonth = theform.user_month.value;
var getformday;
getformday = theform.user_day.value;
var subreturndate;
subreturndate=0;
subreturndate = isrightdate(getformyear,getformmonth,getformday);
if (subreturndate == 1)
{
alert(getformyear+"年"+getformmonth+"月只有三十天,请您重新填写日期!");
return false;
}
if (subreturndate == 2)
{
alert(getformyear+"年二月只有29天,请您重新填写日期!");
return false;
}
if (subreturndate == 3)
{
alert(getformyear+"年二月只有28天,请您重新填写日期!");
return false;
}
if (theform.user_duty.value=="")
{
alert("请您填写职称或职务!");
theform.user_duty.focus();
return (false);
}
if (theform.user_workplace.value=="")
{
alert("请您填写工作单位!");
theform.user_workplace.focus();
return (false);
}
if (theform.user_address.value=="")
{
alert("请您填写通信地址!");
theform.user_address.focus();
return (false);
}
if (theform.user_tel.value=="")
{
alert("请您填写联系电话!");
theform.user_tel.focus();
return (false);
}
if (theform.user_email.value=="")
{
alert("请您填写电子箱信地址!");
theform.user_email.focus();
return (false);
}
return (true);
}
function onClick()
{
this.location.replace("default.jsp");
}
-->
</script>
<LINK REL="stylesheet" HREF="littleproject.css" TYPE="text/css">
<TITLE>用户信息更改</TITLE>
</HEAD>
<BODY bgcolor=LightBlue>
<%
try
{ com.PoolBean pool = new com.PoolBean();
String user_code="",user_name="",user_password="",user_sex="";
String user_birthday="",user_year="",user_email="";
String user_month="",user_day="",user_duty="",user_workplace="";
String user_tel="",user_address="";
if (pool.getConnectionSize() == 0)
{
pool.initializePool();
}
Connection con = null;
Statement stmt = null;
con = pool.getConnection();
stmt= con.createStatement();
ResultSet rs=null;
String strSel = "select * from user where code='"+strLoginUser+"'" ;
rs = stmt.executeQuery(strSel);
while (rs.next())
{
user_password=rs.getString("password");
user_sex=rs.getString("sex");
user_birthday=rs.getString("birthday");
user_duty=rs.getString("duty");
user_workplace=rs.getString("workplace");
user_address=rs.getString("address");
user_tel=rs.getString("telephone");
user_email=rs.getString("email");
}
%>
<center>
<font size="5" face="隶书">用户信息更改</font><br><br>
<form action="User_updateext.jsp" method=POST onsubmit="return isok(this)">
<TABLE border=1 bordercolor=RoyalBlue bgcolor=LightBlue width=400>
<tr>
<TD width=100 align=center>密 码</TD>
<TD width=300 align=left>
<input type="password" size="30" name="user_password"
value="<%= user_password %>"
style="border-style: solid; border-width: 1">
</TD>
</tr>
<tr>
<TD width=100 align=center>密码确认</TD>
<TD width=300 align=left>
<input type="password" size="30" name="confirm_password"
value="<%= user_password %>" style="border-style: solid; border-width: 1">
</TD>
</tr>
<tr>
<TD width=100 align=center>性 别</TD>
<TD width=300 align=left>
<%
if (user_sex.equals("m"))
{
%>
<input type="radio" name="user_sex" value="m" checked>男
<input type="radio" name="user_sex" value="f">女
<%
}
else
{
%>
<input type="radio" name="user_sex" value="m">男
<input type="radio" name="user_sex" value="f" checked>女
<%
}
%>
</TD>
</tr>
<tr>
<TD width=100 align=center>出年日期</TD>
<TD width=300 align=left>
<input type="text" size="7" name="user_year" value="<%=user_birthday.substring(0,4)%>" style="border-style: solid; border-width: 1">年
<select name="user_month" size="1">
<option value="<%=user_birthday.substring(5,7)%>">
<%=user_birthday.substring(5,7)%>
</option>
<%
for (int i=0; i<10;i++)
{
%>
<option value="0<%=i+1%>"><%=i+1%></option>
<%
}
for (int i=10; i<12;i++)
{
%>
<option value="<%=i+1%>"><%=i+1%></option>
<%
}
%>
</select>月
<select name="user_day" size="1">
<option value="<%=user_birthday.substring(8,10)%>">
<%=user_birthday.substring(8,10)%>
</option>
<%
for (int j=1; j<10;j++)
{
%>
<option value="0<%=j%>"><%=j%></option>
<%
}
for (int j=10; j<32;j++)
{
%>
<option value="<%=j%>"><%=j%></option>
<%
}
%>
</select>日
</TD>
</tr>
<tr>
<TD width=100 align=center>职 务</TD>
<TD width=300 align=left>
<input type="text" size="30" name="user_duty" value="<%= user_duty %>"
style="border-style: solid; border-width: 1">
</TD>
</tr>
<tr>
<TD width=100 align=center>工作单位</TD>
<TD width=300 align=left>
<input type="text" size="40" name="user_workplace"
value="<%= user_workplace %>"
style="border-style: solid; border-width: 1">
</TD>
</tr>
<tr>
<TD width=100 align=center>通信地址</TD>
<TD width=300 align=left>
<input type="text" size="40"
name="user_address" value="<%=user_address%>"
style="border-style: solid; border-width: 1">
</TD>
</tr>
<tr>
<TD width=100 align=center>联系电话</TD>
<TD width=300 align=left>
<input type="text" size="40"
name="user_tel" value="<%=user_tel %>"
style="border-style: solid; border-width: 1">
</TD>
</tr>
<tr>
<TD width=100 align=center>邮件地址</TD>
<TD width=300 align=left>
<input type="text" size="40" name="user_email"
value="<%=user_email %>" style="border-style: solid; border-width: 1">
</TD>
</tr>
</TABLE>
<input type="submit" value="更 改">
<input type="reset" value="取 消">
<input type="button" onClick="onClick()" value="退 出">
</form>
</CENTER>
<%
stmt.close();//关闭Statement对象
pool.releaseConnection(con);
}
catch(Exception e)
{
System.out.println("Exception: " + e.getMessage());
}
%>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -