?? ctrlservlet.java
字號(hào):
request.setAttribute("DisplyMsg",DisplyMsg);
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}
if(ok){
DisplyMsg="你的報(bào)名信息已成功保存,如要修改,請(qǐng)選擇“修改報(bào)名登記”";
request.setAttribute("DisplyType","deldata");
request.setAttribute("DisplyMsg",DisplyMsg);
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}else{
DisplyMsg="本次操作失敗,請(qǐng)重試";
request.setAttribute("DisplyType","deldata");
request.setAttribute("DisplyMsg",DisplyMsg);
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}
}
if(ctrl.equals("4")){//刪除報(bào)考信息
String DisplyMsg=null;
boolean ok=false;
HttpSession session=request.getSession();
String ExaminationCode=(String)session.getAttribute("ExaminationCode");
if(ExaminationCode==null){
DisplyMsg="你的session已失效,請(qǐng)檢查你的瀏覽器cookie是否打開,<br>刪除信息失敗";
request.setAttribute("DisplyMsg",DisplyMsg);
request.setAttribute("DisplyType","deldata");
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}
else{
try{ok=b1.deldata(ExaminationCode);
}catch(SQLException ee){DisplyMsg="系統(tǒng)數(shù)據(jù)庫(kù)異常,操作失敗,請(qǐng)稍后再登錄。<br>如有問題請(qǐng)與招生辦聯(lián)系<br>";
request.setAttribute("DisplyType","deldata");
request.setAttribute("DisplyMsg",DisplyMsg);
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}
if(ok){
DisplyMsg="你的報(bào)名信息已成功刪除,如要重新報(bào)名,請(qǐng)?jiān)俅巫?cè)";
request.setAttribute("DisplyType","deldata");
request.setAttribute("DisplyMsg",DisplyMsg);
session.removeAttribute("ExaminationCode");
session.removeAttribute("NetworkCode");
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}else{
DisplyMsg="本次操作失敗,請(qǐng)重試";
request.setAttribute("DisplyType","deldata");
request.setAttribute("DisplyMsg",DisplyMsg);
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}
}
}
if(ctrl.equals("5")){//按問題和答案查找密碼
String ExaminationCode=(String)request.getParameter("txtExaminationCode");
String sltQuestion=(String)request.getParameter("sltQuestion");
String txtAnswer=(String)request.getParameter("txtAnswer");
String ok=null;
String DisplyMsg=null;
try{
ok=b1.getExampassword(ExaminationCode,sltQuestion,txtAnswer);
}catch(SQLException ee){DisplyMsg="系統(tǒng)數(shù)據(jù)庫(kù)異常,操作失敗,請(qǐng)稍后再登錄。<br>如有問題請(qǐng)與招生辦聯(lián)系<br>";
request.setAttribute("DisplyType","findpassword");
request.setAttribute("DisplyMsg",DisplyMsg);
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}
if(ok!=null){
DisplyMsg=ok;} //顯示密碼和網(wǎng)報(bào)號(hào)
else{ DisplyMsg="你回答的問題不正確,無法找到你密碼,<br>請(qǐng)你與長(zhǎng)民政職業(yè)技術(shù)學(xué)院招生辦聯(lián)系";}
request.setAttribute("DisplyType","findpassword");
request.setAttribute("DisplyMsg",DisplyMsg);
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}
if(ctrl.equals("6")){//修改密碼
HttpSession session=request.getSession();
String NetworkCode=(String)request.getParameter("txtNetworkCode");
String oldPassword=(String)request.getParameter("txtOldPassword");
String newPassword=(String)request.getParameter("txtNewPassword");
boolean ok=false;
String DisplyMsg=null;
try{
ok= b1.changepassword(NetworkCode,oldPassword,newPassword) ;
}catch(SQLException ee){out.print(ee.toString());}
if(ok){ DisplyMsg="密碼修改成功,請(qǐng)用新密碼登錄";}//顯示修改成功
else{DisplyMsg="修改密碼失敗,可能考生號(hào)或原密碼有錯(cuò)";}
request.setAttribute("DisplyType","chandepassword");
request.setAttribute("DisplyMsg",DisplyMsg);
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}
//-----刪除確認(rèn)-----------------------
if(ctrl.equals("7")){
String DisplyMsg=null;
HttpSession session=request.getSession();
String ExaminationCode=(String)session.getAttribute("ExaminationCode");
if(ExaminationCode==null){
DisplyMsg="你還沒登錄,不能刪除信息<br>";
DisplyMsg=DisplyMsg+"如果你已登錄,但不能進(jìn)行該功能操作,請(qǐng)檢查你的瀏覽器cookie是否打開<br>";
request.setAttribute("DisplyMsg",DisplyMsg);
request.setAttribute("DisplyType","deldata");
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}
else{
DisplyMsg="你確認(rèn)要?jiǎng)h除你的報(bào)名信息嗎? <a href=\"/csmyzsweb/ctrlservlet?ctrl=4\"><font size=\"4\" color=\"red\">是</font></a> <a href=\"/csmyzsweb/Main.jsp\"><font size=\"4\" color=\"red\">否</font></a> ";
request.setAttribute("DisplyType","comfimdel");
request.setAttribute("DisplyMsg",DisplyMsg);
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}
}
//---------退出系統(tǒng)-------------------
if(ctrl.equals("8")){
String DisplyMsg=null;
HttpSession session=request.getSession();
String ExaminationCode=(String)session.getAttribute("ExaminationCode");
if(ExaminationCode!=null){
session.removeAttribute("ExaminationCode");}
DisplyMsg="你已安全退出登錄";
request.setAttribute("DisplyType","exit");
request.setAttribute("DisplyMsg",DisplyMsg);
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}
//---------調(diào)用數(shù)據(jù)修改 頁--------------------------
if(ctrl.equals("9")){
String DisplyMsg=null;
HttpSession session=request.getSession();
String ExaminationCode=(String)session.getAttribute("ExaminationCode");
if(ExaminationCode==null){
session.removeAttribute("ExaminationCode");
DisplyMsg="你還沒有登錄,請(qǐng)登錄后再進(jìn)行該項(xiàng)操作<br>";
DisplyMsg=DisplyMsg+"如果你已登錄,但不能進(jìn)行該功能操作,請(qǐng)檢查你的瀏覽器cookie是否打開<br>";
request.setAttribute("DisplyType","exit");
request.setAttribute("DisplyMsg",DisplyMsg);
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}
else{
try{
ResultSet rs= b1.getOneResultSet(ExaminationCode) ;
if((rs==null) || !(rs.next())){throw new SQLException();}
request.setAttribute("displydata",rs);
getServletConfig().getServletContext().getRequestDispatcher("/InformationEdit.jsp").forward(request,response);
}catch(SQLException ee){
DisplyMsg="系統(tǒng)數(shù)據(jù)庫(kù)異常,操作失敗,請(qǐng)稍后再登錄。<br>如有問題請(qǐng)與招生辦聯(lián)系<br>";
request.setAttribute("DisplyType","databrowe");
request.setAttribute("DisplyMsg",DisplyMsg);
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}
}
}
//-----查報(bào)名人數(shù)是否已超過5000----------------
if(ctrl.equals("10")){
int count;
String DisplyMsg=null;
try{ count=b1.getExamstudentcount();
if(count>=5000){
DisplyMsg="對(duì)不起,本院今年計(jì)劃只接收5000人的報(bào)名,現(xiàn)名額已滿,你已不能再報(bào)名了";
request.setAttribute("DisplyMsg",DisplyMsg);
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}else{
getServletConfig().getServletContext().getRequestDispatcher("/Register.jsp").forward(request,response);
}
}catch(SQLException ee){
DisplyMsg="系統(tǒng)數(shù)據(jù)庫(kù)異常,操作失敗,請(qǐng)稍后再登錄。<br>如有問題請(qǐng)與招生辦聯(lián)系<br>";
request.setAttribute("DisplyType","databrowe");
request.setAttribute("DisplyMsg",DisplyMsg);
getServletConfig().getServletContext().getRequestDispatcher("/Msgdisply.jsp").forward(request,response);
}
}
}// end if (ctrl!=null)
}
//Clean up resources
public void destroy() {
b1=null;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -