欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    学生管理系统(JSP版)(共29页).doc

    • 资源ID:14139145       资源大小:96.50KB        全文页数:29页
    • 资源格式: DOC        下载积分:20金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要20金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    学生管理系统(JSP版)(共29页).doc

    精选优质文档-倾情为你奉上学生管理系统(JSP版)登录界面:<% page language="java" contentType="text/html; charset=gb2312"pageEncoding="GB2312"%><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta http-equiv="Content-Language" content="zh-cn"><title>登录</title><!- javaScript函数 validateLogin(),用来验证是否填写了用户名和密码:-><script language="JavaScript"><!- function validateLogin() var strUserName = document. frmLogin. StrName.value; var strPassword = document. frmLogin. StrPassword.value; if (strUserName ="") alert("请您输入用户名!"); strUserName.focus(); return false; if (strPassword ="") alert("请输入密码!"); strPassword.focus(); return false; -></script><style type="text/css"><!-body background-image: url(login.JPG);background-repeat: repeat;-></style></head><body bgcolor=cyan><p><img src="Logo.jpg" width="1228" height="193"></p><p>&nbsp;</p><form method="post" name="frmLogin" action="Judge.jsp"onSubmit="javaScript: return validateLogin();"><h1 align=center >学生管理系统</h1><div align="center"><br> <br> <table align="center" bgColor="#CCCCCC" border="1" cellPadding="1"cellSpacing="1" width="300"> <tr> <td align="center" height="47" width="94">用户名:</td> <td height="47" width="172" align="center"> <input name="StrName" type="text" > </td> </tr> <tr> <td align="center" height="47" width="94">密&nbsp;&nbsp;码:</td> <td height="47" width="172" align="center"> <input name="StrPassword" type="password" ></td> </tr> <tr> <td align="center" height="47" width="94"></td> <td height="47" width="172"><input name="Submit" type="submit"value="提 交"> &nbsp;&nbsp;&nbsp; <input name="Reset" type="reset"value="重 置"></td> </tr> </table> </div></form></body></html>用户验证:<% page contentType="text/html;charset=GB2312" %><% page import="java.sql.*" %> <%! public String getString(String str) String s = str;try byte bb = s.getBytes("GB2312");s = new String(bb);catch (Exception e) return s; %> <% Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); Connection conn; Statement stmt; ResultSet rs; String uri = "jdbc:microsoft:sqlserver:/localhost:1433;DatabaseName=stuMan" String user = "sa" String password = "sa" conn = DriverManager.getConnection(uri,user,password); stmt = conn.createStatement(); String strUser = request.getParameter("StrName"); String strPwd = request.getParameter("StrPassword"); String condition = "select * from users where uno='"+strUser+"'and upass='"+ strPwd +"'" rs = stmt.executeQuery(condition); if(rs.next() Integer s3 = rs.getInt(3);if(s3=1) response.sendRedirect("StuInfo.jsp");if(s3=0) session.setAttribute("StrName",getString(strUser);response.sendRedirect("Indiv.jsp"); else response.sendRedirect("Login.jsp"); rs.close(); stmt.close(); conn.close(); %><html> <head><title>Judge.jsp</title> </head> <body bgcolor=cyan> </body></html>跳转界面1:<% page language="java" import="java.util.*" pageEncoding="GB2312"%><% page import="myBean.Students" %><jsp:useBean id="student1" class="myBean.Students" scope="request"></jsp:useBean><html> <head> <title>学生信息</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css"><!-body background-image: url(StuInfo.jpg);background-repeat: repeat;-></style></head> <body bgcolor=cyan> <h4 align="center">所有学生信息表 </h4><br> <jsp:getProperty name="student1" property="queryResult" /> </body></html>后台代码:package myBean;import java.sql.*;public class Students StringBuffer queryResult;public Students() queryResult = new StringBuffer();try Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");catch (Exception e) public String handleString(String s) String str = s;try byte bb = str.getBytes("GB2312");str = new String(bb);return str;catch (Exception e) return str;public StringBuffer getQueryResult() Connection conn;Statement stmt;ResultSet rs;String uri = "jdbc:microsoft:sqlserver:/localhost:1433;DatabaseName=stuMan"String user = "sa"String password = "sa"try queryResult.append("<table align=center border=1 bgcolor=#FFFFFF>");conn = DriverManager.getConnection(uri, user, password);stmt = conn.createStatement();rs = stmt.executeQuery("select * from student");queryResult.append("<tr align=center>");queryResult.append("<th align=center width=50>学号</th>");queryResult.append("<th align=center width=50>姓名</th>");queryResult.append("<th align=center width=50>性别</th>");queryResult.append("<th align=center width=50>班级</th>");queryResult.append("<th align=center width=100>地址</th>");queryResult.append("<th align=center width=80>出生日期</th>");queryResult.append("<th align=center width=100>联系方式</th>");queryResult.append("<th align=center width=100>电子邮件</th>");queryResult.append("<th align=center width=80>操作列</th>");queryResult.append("</tr>");while(rs.next() queryResult.append("<tr align=center>");for(int k=1;k<=8;k+)queryResult.append("<td align=center>" + handleString(rs.getString(k) + "</td>");queryResult.append("<td align=center><a href=Update.jsp?sno="+ handleString(rs.getString(1)+ ">修改</a>|<a href=Delete.jsp?sno="+ handleString(rs.getString(1)+ ">删除</a></td>");queryResult.append("</tr>");queryResult.append("</table>");queryResult.append("<br>");queryResult.append("<div align='center' >");queryResult.append("<a href='Addshow.jsp'>增加</a>");queryResult.append("&nbsp;");queryResult.append("&nbsp;");queryResult.append("&nbsp;");queryResult.append("&nbsp;");queryResult.append("<a href='Login.jsp'>返回登录界面</a>");queryResult.append("</div>");conn.close();catch (SQLException e) e.printStackTrace();return queryResult;跳转界面2:<% page language="java" import="java.util.*" pageEncoding="GB2312"%><% page import="java.sql.*" %><%!public String getString(String s) String str = s;try byte bb = str.getBytes("GB2312");str = new String(bb);return str;catch (Exception e) return str;%><html> <head> <title>学生信息</title> </head> <body bgcolor=cyan> <h4 align="center">学生个人信息表 </h4><br> <% String number = (String)session.getAttribute("StrName"); String condition = "select * from student where sno = '"+number +"'" Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); Connection conn ;Statement stmt;ResultSet rs;String uri = "jdbc:microsoft:sqlserver:/localhost:1433;DatabaseName=stuMan"String user = "sa"String password = "sa"try out.print("<table align='center' border=1 bgcolor=#FFFFFF>");conn = DriverManager.getConnection(uri, user, password);stmt = conn.createStatement();rs = stmt.executeQuery(condition);out.print("<tr align='center'>");out.print("<th align='center' width=50>学号</th>");out.print("<th align='center' width=50>姓名</th>");out.print("<th align='center' width=50>性别</th>");out.print("<th align='center' width=50>班级</th>");out.print("<th align='center' width=100>地址</th>");out.print("<th align='center' width=80>出生日期</th>");out.print("<th align='center' width=100>联系方式</th>");out.print("<th align='center' width=100>电子邮件</th>");out.print("<th align='center' width=80>操作列</th>");out.print("</tr>");while(rs.next() out.print("<tr align=center>");for(int k=1;k<=8;k+)out.print("<td align='center'>" + getString(rs.getString(k) + "</td>");out.print("<td align=center><a href=IndivUpdate.jsp?sno="+ getString(rs.getString(1)+ ">修改</a></td>");out.print("</tr>");out.print("</table>");out.print("<br>");out.print("<div align='center' ><a href='Login.jsp'"+">返回登录界面</a></div>");conn.close();catch (SQLException e) e.printStackTrace(); %> </body></html>添加界面:<% page language="java" import="java.util.*" pageEncoding="GB2312"%><% page import="myBean.Students" %><% page import="myBean.AddBean" %><jsp:useBean id="query1" class="myBean.Students" scope="request" ></jsp:useBean><jsp:useBean id="student1" class="myBean.AddBean" scope="request" ></jsp:useBean><html> <head><title>添加学生信息界面</title></head> <body bgcolor=cyan> <h2 align="center">添加学生信息界面</h2> <hr size="4" width=80%> <br> <form name="form1" method="post" action=""> <div align="center"> <table bgcolor=#FFFFFF width="280" height="280" border="1" align="center"> <tr> <td width="60"><div align="center">学号</div></td> <td width="189"><div align="center"> <input type="text" name="strsno"> </div></td> </tr> <tr> <td><div align="center">姓名</div></td> <td><div align="center"> <input type="text" name="sname"> </div></td> </tr> <tr> <td><div align="center">性别</div></td> <td><div align="center"> <input type="radio" name="sex" value="男"> 男 <input type="radio" name="sex" value="女"> 女</div></td> </tr> <tr> <td><div align="center">班级</div></td> <td><div align="center"> <input type="text" name="className"> </div></td> </tr> <tr> <td><div align="center">地址</div></td> <td><div align="center"> <input type="text" name="address"> </div></td> </tr> <tr> <td><div align="center">出生日期</div></td> <td><div align="center"> <input type="text" name="birthday"> </div></td> </tr> <tr> <td><div align="center">联系方式</div></td> <td><div align="center"> <input type="text" name="phone"> </div></td> </tr> <tr> <td><div align="center">电子邮件</div></td> <td><div align="center"> <input type="text" name="email"> </div></td> </tr> </table> <p><input type="submit" name="tijiao" value="提交"> &nbsp;&nbsp; <input type="reset" name="chongzhi" value="重置"> <p><a href="StuInfo.jsp">返回</a></p> </div> </form> <br> <jsp:setProperty name="student1" property="*"/> <jsp:getProperty name="student1" property="addMessage" /> </body></html>后台代码:package myBean;import java.sql.*;public class AddBean String strsno = ""String sname = ""String sex = ""String className = ""String address = ""String birthday = ""String phone = ""String email = ""String addMessage = ""public AddBean() try Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");catch (Exception e) public String getString(String str) String s = str;try byte bb = s.getBytes("GB2312");s = new String(bb);catch (Exception e) return s;public String getStrsno() return strsno;public void setStrsno(String strsno) try strsno = new String(strsno.getBytes("ISO-8859-1"),"Gb2312");catch (Exception e) e.printStackTrace();this.strsno = strsno.trim();public String getSname() return sname;public void setSname(String sname) try sname = new String(sname.getBytes("ISO-8859-1"),"Gb2312");catch (Exception e) e.printStackTrace();this.sname = sname.trim();public String getSex() return sex;public void setSex(String sex) try sex = new String(sex.getBytes("ISO-8859-1"),"Gb2312");catch (Exception e) e.printStackTrace();this.sex = sex.trim();public String getClassName() return className;public void setClassName(String className) try className = new String(className.getBytes("ISO-8859-1"),"Gb2312");catch (Exception e) e.printStackTrace();this.className = className.trim();public String getAddress() return address;public void setAddress(String address) try address = new String(address.getBytes("ISO-8859-1"),"Gb2312");catch (Exception e) e.printStackTrace();this.address = address.trim();public String getBirthday() return birthday;public void setBirthday(String birthday) try birthday = new String(birthday.getBytes("ISO-8859-1"),"Gb2312");catch (Exception e) e.printStackTrace();this.birthday = birthday.trim();public String getPhone() return phone;public void setPhone(String phone) try phone = new String(phone.getBytes("ISO-8859-1"),"Gb2312");catch (Exception e) e.printStackTrace();this.phone = phone.trim();public String getEmail() return email;public void setEmail(String email) try email = new String(email.getBytes("ISO-8859-1"),"Gb2312");catch (Exception e) e.printStackTrace();this.email = email.trim();public String getAddMessage() if(strsno.equals("")addMessage = "没有插入记录"elseString condition = "insert student values(?,?,?,?,?,?,?,?)"/String condition = "insert student values('"+strsno+"','"+sname+"','"+sex+"','"+className+"','"+address+"','"+birthday+"','"+phone+"','"+email+"')"String uri = "jdbc:microsoft:sqlserver:/localhost:1433;DatabaseName=stuMan"String user = "sa"String password = "sa"Connection conn;PreparedStatement stmt;try conn = DriverManager.getConnection(uri, user, password);stmt = conn.prepareStatement(condition);stmt.setString(1, strsno);stmt.setString(2, sname);stmt.setString(3, sex);stmt.setString(4, className);stmt.setString(5, address);stmt.setString(6, birthday);stmt.setString(7, phone);stmt.setString(8, email);int m = stmt.executeUpdate();if(m!=0)addMessage = "对表中添加" + m + "记录"elseaddMessage = "添加记录失败!"stmt.close();conn.close();

    注意事项

    本文(学生管理系统(JSP版)(共29页).doc)为本站会员(飞****2)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开