?? modifystuinfo.jsp
字號:
<%@page contentType="text/html; charset=gb2312" errorPage=""%>
<%@page import="java.sql.*,sms.db.*,sms.bean.*,java.util.*"%>
<%
request.setCharacterEncoding("gb2312");
//取得頁面表單提交的參數(shù)
String queryFlag = request.getParameter("queryButton");
String modifyFlag = request.getParameter("modifyButton");
StuDetailBean stuDetailBean = null;
String flag = null;//控制修改按鈕是否可見的標志
String stuId = "";
String password = "";
String name = "";
String sex = "";
String age = "";
String specialty = "";
String nationality = "";
String college = "";
String character = "";
String lenOfSchooling = "";
String enrollTime = "";
String address = "";
String remark = "";
String telephone = "";
String eMail = "";
if (queryFlag != null) {//如果單擊查詢按鈕
stuId = request.getParameter("studentId");
if (stuId == null || stuId.equals("")) {
%>
<script language="javascript" type="">
alert('請輸入學號號!');
</script>
<%
} else {
StuDetailBean stuDBean = new StuDetailBean();
stuDetailBean = stuDBean.queryStuDetail(stuId);//查詢該學生詳細信息
System.out.print("test in modifyStuInfo.jsp 00 name:"+stuDetailBean.getName());/////////////////
if(stuDetailBean != null && stuDetailBean.getName() != null){
name = stuDetailBean.getName();
sex = (stuDetailBean.getSex() != null && stuDetailBean.getSex().equals("0"))?
"女":"男" ;
age = stuDetailBean.getAge();
nationality = stuDetailBean.getNationality();
college = stuDetailBean.getCollegeName();
character = stuDetailBean.getCharacter();
lenOfSchooling = stuDetailBean.getLenOfSchooling();
enrollTime = stuDetailBean.getEnrollTime();
address = stuDetailBean.getAddress();
telephone = stuDetailBean.getTelephone();
eMail = stuDetailBean.getEMail();
specialty = stuDetailBean.getSpecialty();
flag = "visible";//查詢成功設(shè)置修改按鈕可見
}else{
%>
<script language="javascript" type="">
alert('沒有該學生信息!');
</script>
<%
}
}
}
if (modifyFlag != null ) {
System.out.println("test in modifyStuInfo.jsp modifyFlag:" + modifyFlag);
StudentBean stuBean = new StudentBean();
stuId = request.getParameter("stuId2");
age = request.getParameter("age");
password = request.getParameter("pwd");
character = request.getParameter("character");
address = request.getParameter("address");
remark = request.getParameter("remark");
telephone = request.getParameter("telephone");
eMail = request.getParameter("eMail");
boolean checkPwdFlag = stuBean.checkPwd(stuId, password);//驗證輸入的密碼是否正確
if (checkPwdFlag == false) {
flag = "visible";//
%>
<script language="javascript" type="">
alert('您輸入的密碼不正確!');
</script>
<%
} else {
//調(diào)用更新學生信息的方法
StuDetailBean stuDetailBean2 = new StuDetailBean();
boolean updateFlag = stuDetailBean2.modifyStuInfo(stuId,age,address, telephone, eMail, character, remark);
if (updateFlag == true) {
%>
<script language="javascript" type="">
alert('修改成功!');
</script>
<%
} else {
flag = "visible";
%>
<script language="javascript" type="">
alert('修改失敗!');
</script>
<%
}
}
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>學生信息修改</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-color: #CCCCCC;
}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="">
<input type="hidden" name="commitFlag" value="submit">
<table width="100%" border="0" align="center">
<tr>
<td height="25" bgcolor="#999999">
<table width="100%" border="0">
<tr>
<td width="33%" height="25" align="right">學號:</td>
<td width="30%">
<input name="studentId" type="text" value="<%=stuId==null?"00564112":stuId%>" class="text1">
</td>
<td width="17%">
<input name="queryButton" type="submit" value="提交">
</td>
<td width="20%"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="360" align="center" valign="top">
<table width="100%" border="1" bordercolorlight= #C1A4F4 borderColorDark=#ffffff cellPadding=0 cellSpacing=0>
<tr>
<td width="46%" height="25" align="right">學號:</td>
<td width="54%">
<input name="stuId2" type="text" class="text1" id="stuId2" size="15" maxlength="15" value="<%=stuId==null?"":stuId%>" readonly="readonly">
</td>
</tr>
<td height="25" align="right">修改時提供密碼:</td>
<td>
<input name="pwd" type="text" class="text1" id="password">
</td>
<tr>
<tr>
<td height="25" align="right">姓名:</td>
<td>
<input name="name" type="text" class="text1" id="name" size="15" maxlength="15" value="<%=name%>" readonly="readonly">
</td>
</tr>
<tr>
<td height="25" align="right">性別:</td>
<td>
<input name="sex" type="text" class="text1" id="sex" size="15" maxlength="15" value="<%=sex%>" readonly="readonly">
</td>
</tr>
<tr>
<td height="25" align="right">年齡:</td>
<td>
<input name="age" type="text" class="text1" id="age" size="10" maxlength="10" value="<%=age%>">
</td>
</tr>
<tr>
<td height="25" align="right">民族:</td>
<td>
<input name="nationality" type="text" class="text1" id="nationality" value="<%=nationality%>" readonly="readonly">
</td>
</tr>
<tr>
<td height="25" align="right">學院:</td>
<td>
<input name="college" type="text" class="text1" id="college" value="<%=college%>" readonly="readonly">
</td>
</tr>
<tr>
<td height="25" align="right">專業(yè):</td>
<td>
<input name="specialty" type="text" class="text1" id="specialty" value="<%=specialty%>" readonly="readonly">
</td>
</tr>
<tr>
<td height="25" align="right">學制:</td>
<td>
<input name="lenOfSchooling" type="text" class="text1" id="lenOfSchooling" value="<%=lenOfSchooling%>" readonly="readonly">
</td>
</tr>
<tr>
<td height="25" align="right">入學年份:</td>
<td>
<input name="enrollTime" type="text" class="text1" id="enrollTime" value="<%=enrollTime%>" readonly="readonly">
</td>
</tr>
<tr>
<td height="25" align="right">政治面貌:</td>
<td>
<input name="character" type="text" class="text1" id="character" value="<%=character%>">
</td>
</tr>
<tr>
<td height="25" align="right">電話:</td>
<td>
<input name="telephone" type="text" class="text1" id="telephone" value="<%=telephone%>">
</td>
</tr>
<tr>
<td height="25" align="right">電子郵件:</td>
<td>
<input name="eMail" type="text" class="text1" id="eMail" value="<%=eMail%>">
</td>
</tr>
<tr>
<td height="60" align="right">家庭住址:</td>
<td>
<textarea name="address" cols="50" rows="4" id="address"><%=address%></textarea>
</td>
</tr>
<tr>
<td height="60" align="right">備注:</td>
<td>
<textarea name="remark" cols="50" rows="5" id="remark"><%=remark%></textarea>
</td>
</tr>
<tr>
<td height="25"> </td>
<td>
<%if (flag != null && flag.equals("visible")) { %>
<input name="modifyButton" type="submit" value="修改" class="button1">
<%} else { %>
<%} %>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="39"> </td>
</tr>
</table>
</form>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -