1.HomePage.jsp//首页,选择操作%@pagelanguage=javaimport=java.util.*pageEncoding=gb2312%%Stringpath=request.getContextPath();StringbasePath=request.getScheme()+://+request.getServerName()+:+request.getServerPort()+path+/;%!DOCTYPEHTMLPUBLIC-//W3C//DTDHTML4.01Transitional//ENhtmlheadbasehref=%=basePath%titleMyJSP'HomePage.jsp'startingpage/titlemetahttp-equiv=pragmacontent=no-cachemetahttp-equiv=cache-controlcontent=no-cachemetahttp-equiv=expirescontent=0metahttp-equiv=keywordscontent=keyword1,keyword2,keyword3metahttp-equiv=descriptioncontent=Thisismypage!--linkrel=stylesheettype=text/csshref=styles.css--/headbodyh1首页,请选择您将要进行的操作:/h1hrahref=Login.jsp一.学生信息查询/abrbrahref=Login1.jsp二.学生信息删除/abrbrahref=Login2.jsp三.学生信息添加/abrbrahref=Login3.jsp四.学生信息修改/a/body/html基于JSP实现连接数据库SQLServer2000的增删改查操作-一个人的旅行-一个人的旅行2.Login.jsp//学生信息查询登入页面%@pagelanguage=javaimport=java.util.*contentType=text/html;charset=gb2312pageEncoding=gb2312%%Stringpath=request.getContextPath();StringbasePath=request.getScheme()+://+request.getServerName()+:+request.getServerPort()+path+/;%!DOCTYPEHTMLPUBLIC-//W3C//DTDHTML4.01Transitional//ENhtmlheadbasehref=%=basePath%titleMyJSP'Login.jsp'startingpage/titlemetahttp-equiv=pragmacontent=no-cachemetahttp-equiv=cache-controlcontent=no-cachemetahttp-equiv=expirescontent=0metahttp-equiv=keywordscontent=keyword1,keyword2,keyword3metahttp-equiv=descriptioncontent=Thisismypage!--linkrel=stylesheettype=text/csshref=styles.css--/headbodycenterh1学生信息查询登入/h1hrformaction=Search.jspmethod=post学生姓名:inputtype=textname=usernamebrinputtype=submitvalue=查询inputtype=resetvalue=重置/form/center/body/html基于JSP实现连接数据库SQLServer2000的增删改查操作-一个人的旅行-一个人的旅行3.Search.jsp//学生信息查询成功页面,显示所查询到的学生信息%@pagelanguage=javaimport=java.util.*,java.sql.*contentType=text/html;charset=gb2312pageEncoding=gb2312%%Stringpath=request.getContextPath();StringbasePath=request.getScheme()+://+request.getServerName()+:+request.getServerPort()+path+/;%!DOCTYPEHTMLPUBLIC-//W3C//DTDHTML4.01Transitional//ENhtmlheadbasehref=%=basePath%titleMyJSP'Display.jsp'startingpage/titlemetahttp-equiv=pragmacontent=no-cachemetahttp-equiv=cache-controlcontent=no-cachemetahttp-equiv=expirescontent=0metahttp-equiv=keywordscontent=keyword1,keyword2,keyword3metahttp-equiv=descriptioncontent=Thisismypage!--linkrel=stylesheettype=text/csshref=styles.css--/headbody恭喜!查询成功!brahref=Login.jsp返回重新查询/abrahref=HomePage.jsp返回首页/ahrh1学生信息列表/h1%//接收学生姓名和学号//Stringu=request.getParameter(username);Stringu=newString(request.getParameter(username).getBytes(ISO-8859-1),gb2312);//1.加载驱动//Class.forName(com.microsoft.jdbc.sqlserver.SQLServerDriver);//2.得到链接//Connectionct=DriverManager.getConnection(jdbc:microsoft:sqlserver://localhost:1433;databaseName=LearnDB;sa;as);Connectionconn=DriverManager.getConnection(jdbc:odbc:LearnDB,sa,as);//3.创建StatementStatementsm=conn.createStatement();//查询出需要显示的记录ResultSetrs=sm.executeQuery(select*fromustudentwheresname='+u+');//显示记录%tableborder=1%while(rs.next()){%trtd学号/tdtd姓名/tdtd性别/tdtd出生日期/tdtd年级/tdtd联系电话/td/trtrtd%=rs.getString(1)%/tdtd%=rs.getString(2)%/tdtd%=rs.getString(3)%/tdtd%=rs.getDate(4)%/tdtd%=rs.getString(5)%/tdtd%=rs.getString(6)%/td/tr/table%}%/body/html基于JSP实现连接数据库SQLServer2000的增删改查操作-一个人的旅行-一个人的旅行4.Login1.jsp//学生信息删除登入页面%@pagelanguage=javaimport=java.util.*pageEncoding=gb2312%%Stringpath=request.getContextPath();StringbasePath=request.getScheme()+://+request.getServerName()+:+request.getServerPort()+path+/;%!DOCTYPEHTMLPUBLIC-//W3C//DTDHTML4.01Transitional//ENhtmlheadbasehref=%=basePath%titleMyJSP'Login1.jsp'startingpage/titlemetahttp-equiv=pragmacontent=no-cachemetahttp-equiv=cache-controlcontent=no-cachemetahttp-equiv=expirescontent=0metahttp-equiv=keywordscontent=keyword1,keyword2,keyword3metahttp-equiv=descriptioncontent=Thisismypage!--linkrel=stylesheettype=text/csshref=styles.css--/headbodycenterh1学生信息删除/h1hrformaction=Delete.jspmethod=post学生姓名:inputtype=textname=snamebrinputtype=submitvalue=删除inputtype=resetvalue=重置/form/center/body/html基于JSP实现连接数据库SQLServer2000的简单增删改查操作-一个人的旅行-一个人的旅行5.Delete.jsp//学生信息删除成功页面%@pagelanguage=javaimport=java.util.*,java.sql.*pageEncoding=gb2312%%Stringpath=request.getContextPath();StringbasePath=request.getScheme()+://+request.getServerName()+:+request.getServerPort()+path+/;%!DOCTYPEHTMLPUBLIC-//W3C//DTDHTML4.01Transitional//ENhtmlheadbasehref=%=basePath%titleMyJSP'Delete.jsp'startingpage/titlemetahttp-equiv=pragmacontent=no-cachemetahttp-equiv=cache-controlcontent=no-cachemetahttp-equiv=expirescontent=0metahttp-equiv=keywordscontent=keyword1,keyword2,keyword3metahttp-equiv=descriptioncontent=Thisismypage!--linkrel=stylesheettype=text/csshref=styles.css--/h