⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modifypassword_jsp.java

📁 学生信息管理系统简单实现 可以简单得实现现阶段学生信息得增加 修改 删除 查看
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import sms.db.*;
import sms.bean.*;
import java.util.*;

public final class modifyPassword_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static java.util.Vector _jspx_dependants;

  public java.util.List getDependants() {
    return _jspx_dependants;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=gb2312");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			"", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");

  request.setCharacterEncoding("gb2312");
  String commitFlag = request.getParameter("modifyButton");
  String stuId = "";
  if (commitFlag != null ) {
    stuId = request.getParameter("stuId");
    String oldPassword = request.getParameter("oldPassword");
    String newPassword = request.getParameter("newPassword");
    String newPassword2 = request.getParameter("newPassword2");
    if (stuId == null || stuId.equals("")) {

      out.write("\r\n");
      out.write("<script language=\"javascript\" type=\"\">\r\n");
      out.write("    alert('请输入学号!');\r\n");
      out.write("    </script>\r\n");

  } else {
    if (!newPassword.equals(newPassword2)) {//验证两次输入的密码是否一致

      out.write("\r\n");
      out.write("<script language=\"javascript\" type=\"\">\r\n");
      out.write("    alert('两次输入的密码不同,请重新输入密码!');\r\n");
      out.write("    </script>\r\n");

  } else {
    StudentBean stuBean = new StudentBean();
    int flag = stuBean.modifyPassword(stuId, oldPassword, newPassword);//调用修改密码的函数
    if (flag == 0) {

      out.write("\r\n");
      out.write("<script language=\"javascript\" type=\"\">\r\n");
      out.write("    alert('您输入的旧密码不正确!');\r\n");
      out.write("    </script>\r\n");
} else if (flag == -2) {
      out.write("\r\n");
      out.write("<script language=\"javascript\" type=\"\">\r\n");
      out.write("    alert('不存在该用户!');\r\n");
      out.write("    </script>\r\n");
} else if (flag == -1) {
      out.write("\r\n");
      out.write("<script language=\"javascript\" type=\"\">\r\n");
      out.write("    alert('修改密码失败!');\r\n");
      out.write("    </script>\r\n");
} else if (flag == 1) {
      out.write("\r\n");
      out.write("<script language=\"javascript\" type=\"\">\r\n");
      out.write("    alert('修改密码成功!');\r\n");
      out.write("    </script>\r\n");

  }
  }
  }
      }

      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
      out.write("<title>无标题文档</title>\r\n");
      out.write("<link href=\"css/style.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
      out.write("<style type=\"text/css\">\r\n");
      out.write("<!--\r\n");
      out.write("body {\r\n");
      out.write("\tbackground-color: #CCCCCC;\r\n");
      out.write("}\r\n");
      out.write("-->\r\n");
      out.write("</style></head>\r\n");
      out.write("<body>\r\n");
      out.write("<form action=\"\" method=\"post\">\r\n");
      out.write("<input type=\"hidden\" name=\"commitFlag\" value=\"submit\">\r\n");
      out.write("<table width=\"100%\" align=\"center\" border=\"1\" bordercolorlight= #C1A4F4  borderColorDark=#ffffff cellPadding=0 cellSpacing=0 >\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td height=\"39\" colspan=\"2\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;学生修改密码</td>\r\n");
      out.write("    </tr>\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td width=\"24%\" height=\"34\" align=\"right\">学号:</td>\r\n");
      out.write("    <td width=\"76%\">\r\n");
      out.write("      <input name=\"stuId\" type=\"text\" class=\"text1\" id=\"stuId\" value=\"");
      out.print(stuId);
      out.write("\" size=\"15\" maxlength=\"20\">\r\n");
      out.write("    </td>\r\n");
      out.write("  </tr>\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td height=\"35\" align=\"right\">原密码:</td>\r\n");
      out.write("    <td>\r\n");
      out.write("      <input name=\"oldPassword\" type=\"password\" class=\"text1\" id=\"oldPassword\" size=\"15\" maxlength=\"20\">\r\n");
      out.write("    </td>\r\n");
      out.write("  </tr>\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td height=\"36\" align=\"right\">新密码:</td>\r\n");
      out.write("    <td>\r\n");
      out.write("      <input name=\"newPassword\" type=\"password\" class=\"text1\" id=\"newPassword\" size=\"15\" maxlength=\"20\">\r\n");
      out.write("    </td>\r\n");
      out.write("  </tr>\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td height=\"37\" align=\"right\">确认新密码:</td>\r\n");
      out.write("    <td>\r\n");
      out.write("      <input name=\"newPassword2\" type=\"password\" class=\"text1\" id=\"newPassword2\" size=\"15\" maxlength=\"20\">\r\n");
      out.write("    </td>\r\n");
      out.write("  </tr>\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td height=\"42\">&nbsp;</td>\r\n");
      out.write("    <td>\r\n");
      out.write("      <input name=\"modifyButton\" type=\"submit\" class=\"button1\" value=\"修改\">\r\n");
      out.write("    </td>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table>\r\n");
      out.write("</form>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -