📄 student_add.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="error.jsp" %><%@ include file="initialization.jsp" %><% String ID=request.getParameter("studentID");String password=request.getParameter("password");String password2=request.getParameter("password2");int surplusNum=Integer.parseInt(xml.getValue("/System/BorrowSum"));String requestPage=request.getParameter("request");String thisPage=application.getRealPath(request.getRequestURI());//out.println(requestPage);//out.println(thisPage);if(requestPage!=null&&thisPage.equals(requestPage)) //如果请求页面非空{ //out.print("<script language='JavaScript'>alert('本页面请求!');</script>"); if(!ID.equals("")&&!password.equals("")&&!password2.equals("")) { long studentID=0; String reg="^[\\d]+$"; if(ID.matches(reg)) { studentID=Long.parseLong(ID); if(!password.equals(password2)) { out.print("<script language='JavaScript'>alert('确认密码与原密码不相同!');</script>"); } else { ResultSet rs=mysql.getResultSet("select * from student where studentID="+studentID+";"); if(rs!=null&&rs.first()) { out.print("<script language='JavaScript'>alert('已经存在此学生!');</script>"); } else { String stat="insert into student(studentID,password,loginDate,surplusNum)" + " values("+studentID+",'"+password+"'," +"'"+dateTime.getDateTime()+"',"+surplusNum+");"; mysql.executeStatement(stat); out.print("<script language='JavaScript'>alert('学生添加成功!');</script>"); } } } else { out.print("<script language='JavaScript'>alert('学号只能是数字!');</script>"); } } else { out.print("<script language='JavaScript'>alert('输入数据不全,请重新输入!');</script>"); }} %><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title></head><body><table width="550" height="455" border="0" cellspacing="0" cellpadding="0" > <tr> <td height="455"> <form id="form1" name="form1" method="post" action=""> <table width="526" cellpadding="0" cellspacing="0" border="1" bordercolor="#C2D1E9" style=" border-bottom-color:#3399CC; border-left-color:#3399CC; border-right-color:#3399CC; border-top-color:#3399CC;font-size:13px" > <tr> <td width="88" height="27" align="right">学 号:</td> <td width="432"><input name="studentID" type="text" size="20" maxlength="50" /> <input name="request" type="hidden" id="request" value=<%="\""+thisPage+"\""%>></td> </tr> <tr> <td height="25" align="right">密 码:</td> <td><input name="password" type="password" id="password" size="20" maxlength="50" /></td> </tr> <tr> <td height="25" align="right"> 确认密码:</td> <td><input name="password2" type="password" id="password2" size="20" maxlength="50" /></td> </tr> <tr> <td height="27" colspan="2" align="right"><input type="submit" name="Submit" value="提交" /> <input type="reset" name="Submit2" value="重置" /> </td> </tr> </table> </form> </td> </tr></table></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -