📄 update.jsp
字号:
<%@ page language="java" contentType="text/html;charset=gbk"%>
<%@ page import="qiuzhi.*"%>
<jsp:useBean id="job" class="qiuzhi.personaljob"/>
<%
String username = request.getParameter("username");
if(username == null || username.length() == 0)
{
%>
<html>
<head>
<title>个人求职管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<link href="../css_js/style.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
function confirm()
{
if(add_form.username.value.length == 0 || add_form.psw.value.length == 0 || add_form.password.value.length == 0)
{
alert("带星号的一定要填写!");
}
else
{
if(add_form.psw.value != add_form.password.value)
{
alert("密码确认不一致!");
}
else
{
add_form.submit();
}
}
}
</script>
<%
String id = (String)session.getAttribute("user_id");
if(id == null)
{
%>
<script language="javascript">
alert("用户登陆出错,请重新登陆");
window.close();
opener.location.href="../index.jsp";
</script>
<%
}
else
{
%>
<%@ include file="../lib/config.jsp" %>
<%
if(!job.init(OracleDriver,OracleUrl,OracleUser,OraclePsw))
{
out.println("<script language=\"JavaScript\" type=\"text/javascript\">alert(\"数据库连接出错\");window.close();</script>");
}
else
{
userTable utable = job.getUserInfo(id);
if(utable == null)
{
%>
<script language="javascript">
alert("没有用户信息,请重新登陆");
window.close();
opener.location.href="../index.jsp";
</script>
<%
}
else
{
System.out.println(utable.getName());
%>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="50" border="0" cellpadding="0" cellspacing="0" bgcolor="#30483C">
<tr>
<td width="290" valign="middle"><img src="../ima/title.gif" width="290" height="50" border="0"></td>
<td align="right" valign="bottom"><font color="#FFFFFF"><strong>修改用户信息</strong></font> </td>
</tr>
</table>
<form name="add_form" method="post" action="update.jsp">
<table width="100%" border="0" cellpadding="1" cellspacing="1">
<tr>
<td align="center" valign="top">
<table width="400" border="0" cellspacing="1" cellpadding="1">
<tr class="text-login">
<td width="60" height="20">用户名</td>
<td width="290" height="20"><input type="text" name="username" class="inputlength120" value="<%=utable.getUsername()%>">*</td>
</tr>
<tr bgcolor="#EEEEEE" class="text-login">
<td width="60" height="20">密码</td>
<td width="290" height="20"><input type="password" name="password" class="inputlength120" value="<%=utable.getPassword()%>">*</td>
</tr>
<tr class="text-login">
<td width="60" height="20">确认密码</td>
<td width="290" height="20"><input type="password" name="psw" class="inputlength120">*</td>
</tr>
<tr bgcolor="#EEEEEE" class="text-login">
<td width="60" height="20">姓名</td>
<td width="290" height="20"><input type="text" name="name" class="inputlength120" value="<%=utable.getName()%>"></td>
</tr>
<tr class="text-login">
<td width="60" height="20">年龄</td>
<td width="290" height="20"><input type="text" name="age" class="inputlength120" value="<%=utable.getAge()%>"></td>
</tr>
<tr bgcolor="#EEEEEE" class="text-login">
<td width="60" height="20">联系电话</td>
<td width="290" height="20"><input type="text" name="telephone" class="inputlength120" value="<%=utable.getTelephone()%>"></td>
</tr>
<tr class="text-login">
<td width="60" height="20">Email</td>
<td width="290" height="20"><input type="text" name="email" class="inputlength120" value="<%=utable.getEmail()%>"></td>
</tr>
<tr bgcolor="#EEEEEE" class="text-login">
<td width="60" height="20">联系地址</td>
<td width="290" height="20"><input type="text" name="address" class="inputlength120" value="<%=utable.getAddress()%>"></td>
</tr>
<tr class="text-login">
<td width="60" height="20">用户类型</td>
<td width="290" height="20">
<select name="role" class="inputlength120">
<option value="0" <%=("0".equals(utable.getRole()) ? "selected" : "")%>>个人用户</option>
<option value="1" <%=("1".equals(utable.getRole()) ? "selected" : "")%>>公司用户</option>
</select></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" height="35" border="0" cellpadding="0" cellspacing="0" bgcolor="#446655">
<tr>
<td width="200" background="ima/pop_bg.gif"> </td>
<td align="right" valign="middle">
<input name="Button" type="button" class="logbutton" value="更新" onClick="confirm()"><input name="Button" type="button" class="logbutton" value="关闭" onClick="window.close();"> </td>
</tr>
</table>
</form>
</body>
</html>
<%
}
}
}
}
else
{
%>
<%@ include file="../lib/config.jsp" %>
<%
if(!job.init(OracleDriver,OracleUrl,OracleUser,OraclePsw))
{
out.println("<script language=\"JavaScript\" type=\"text/javascript\">alert(\"数据库连接出错\");window.close();</script>");
}
else
{
username = new String(username.getBytes("ISO8859_1"));
String password = request.getParameter("password");
String name = request.getParameter("name");
name = (name == null ? "" : (new String(name.getBytes("ISO8859_1"))));
String address = request.getParameter("address");
address = (address == null ? "" : (new String(address.getBytes("ISO8859_1"))));
String age = request.getParameter("age");
age = (age == null ? "0" : age);
String tel = request.getParameter("telephone");
tel = (tel == null ? "12345678" : tel);
String role = request.getParameter("role");
role = (role == null ? "0" : role);
String email = request.getParameter("email");
email = (email == null ? "0" : email);
userTable utable = new userTable();
utable.setId((String)session.getAttribute("user_id"));
utable.setUsername(username);
utable.setPassword(password);
utable.setName(name);
utable.setAge(age);
utable.setTelephone(tel);
utable.setAddress(address);
utable.setRole(role);
utable.setEmail(email);
int re = job.updateUser(utable);
if(re == 1)
{
out.println("<script language=\"JavaScript\" type=\"text/javascript\">alert(\"修改成功\");window.close();</script>");
}
else
{
out.println("<script language=\"JavaScript\" type=\"text/javascript\">alert(\"修改不成功\");window.close();</script>");
}
}
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -