📄 update.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="cn.zd.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE2 {font-weight: bold}
-->
</style>
<script language="javascript">
function f(){
if(document.form1.email.value.indexOf(".")==-1||document.form1.email.value.indexOf("@")==-1){
alert("你输入的email地址格式不真确,如:(Jhon@163.com)");
return false;
}
return true;
}
</script>
</head>
<body>
<center>
<table>
<tr>
<td>修改基本信息</td>
<td><a href="password.jsp">修改密码</a></td>
</tr>
</table></center>
<%
if(session.getAttribute("username")!=null||session.getAttribute("username")!="")
{
String username=(String)session.getAttribute("username");
Note note = null ;
try
{
note =DAOFactory.getNoteDAOInstance().queryById(username);
}
catch(Exception e)
{}
if(note!=null){
int user_id=note.getUser_id();
username=note.getUsername();
String password=note.getPassword();
int sex=note.getSex();
String tag=note.getTag();
String qq=note.getQq();
String email=note.getEmail();
String how=note.getHow();
String works=note.getWorks();
String phone=note.getPhone();
%>
<legend>请填写您的基本信息</legend>
<span style="float:right">请注意:带有 <span class="STYLE1">* </span>的项目必须填写</span>
<form action="update_do.jsp" method="post" name="form1" id="form1" onSubmit="return f()">
<table width="93%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" bgcolor="#F6F6F6"></td>
</tr>
<tr>
<td width="183" height="30" align="right">头像:</td>
<td width="468"><label>
<SELECT name="tag" id="tag" onChange="document.x1.src=options[selectedIndex].value">
<option value="<%=tag %>" selected><%=tag.substring(12,14)%></option>
<% for(int i=1;i<=20;i++){%>
<option value="images/head/<%=i%>.gif"><%=i%></option>
<%}%>
</select>
<img width=45 height=47 src="<%=tag %>" name="x1"></label></td>
</tr>
<tr>
<td colspan="2" bgcolor="#F6F6F6"></td>
</tr>
<tr>
<td height="30" align="right">性别:</td>
<td>
<input name="sex" type="radio" value="1" <%if(sex==1) {%> checked="checked" <%} %>/>
男
<input type="radio" name="sex" value="0"<%if(sex==0) {%> checked="checked" <%} %> />
女</td>
</tr>
<tr>
<td height="30" align="right">联系电话:</td>
<td><input name="phone" value="<%=phone %>" type="text" class="inputstyle" id="phone" size="20" maxlength="40" /></td>
</tr>
<tr>
<td colspan="2" bgcolor="#F6F6F6"></td>
</tr>
<tr>
<td height="30" align="right"><span class="STYLE1">*</span>Email:</td>
<td><input name="email" value="<%=email %>" type="text" class="inputstyle" id="email" size="20" maxlength="50" /></td>
</tr>
<tr>
<td colspan="2" bgcolor="#F6F6F6"></td>
</tr>
<tr>
<td height="30" align="right">QQ:</td>
<td><input name="qq" value="<%=qq %>" type="text" class="inputstyle" id="qq" size="20" maxlength="20" /></td>
</tr>
<tr>
<td colspan="2" bgcolor="#F6F6F6"></td>
</tr>
<tr>
<td height="30" align="right">职业:</td>
<td><input name="works" value="<%=works %>" type="text" class="inputstyle" id="works" size="20" maxlength="128" /></td>
</tr>
<tr>
<td colspan="2" bgcolor="#F6F6F6"></td>
</tr>
<tr>
<td height="30" align="right">兴趣爱好:</td>
<td><input name="how" value="<%=how %>" type="text" class="inputstyle" id="how" size="20" maxlength="40" />
<input type="hidden" value="<%=username %>" name="username"><input type="hidden" name="user_id" value="<%=user_id %>"></td>
</tr>
<tr>
<td colspan="2" bgcolor="#F6F6F6"></td>
</tr>
<tr>
<td height="50" colspan="2" align="center"><label>
<input name="Submit" type="submit" class="inputstyle" value=" 更 新 " />
<input name="Submit2" type="reset" class="inputstyle" value=" 重 填 " />
</label></td>
</tr>
</table>
</form>
<%}
}
else
{
// 用户未登陆,提示用户登陆,并跳转
response.setHeader("refresh","5;URL=index.jsp") ;
%>
您还未登陆,请先登陆!!!<br>
两秒后自动跳转到登陆窗口!!!<br>
如果没有跳转,请按<a href="index.jsp">这里</a>!!!<br>
<%
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -