篇一:jsp课程设计模板、 洛阳理工学院课程设计 课程名称 学生姓名专业软件学院班级z14055学号z指导教师成绩 篇二:jsp登陆界面 用jsp做的一个简单的登陆界面,连接mysql,数据库名字为school,表为user。 主要分为四个jsp界面:index.jsp登陆界面,check.jsp检验页面,main.jsp登陆成功界面,error.jsp登陆失败界面。 如下所示: 登陆界面 提交"style="height:30px;width:80px"> 取消"style="height:30px;width:80px> 登陆界面 stringusername=newstring(request.getparameter("username").getbytes("iso-8859-1"),"utf-8"); stringpassword=newstring(request.getparameter("userpass").getbytes("iso-8859-1"),"utf-8"); session.setattribute("name",username); connectiondbconn=null; statementstmt=null; Resultsetrs=null; if(username.equals("")){ response.sendRedirect("index.jsp"); } try{ stringdriver="com.mysql.jdbc.driver"; stringurl="jdbc:mysql://localhost:3306/school"; stringuser="sa"; stringpassword="123"; class.forname(driver); dbconn=drivermanager.getconnection(url,user,password); stmt=dbconn.createstatement(); stringsql1="select*fromuserwhereusername="+username+""; rs=stmt.executequery(sql1); if(rs.next()){ //stringsql2="select*fromuserwherepassword="+password+""; //rs=stmt.executequery(sql2); //判断用户密码是否正确 stringuserpass=rs.getstring("password"); if(userpass.equals(password)){ response.sendRedirect("main.jsp");} else{ response.sendRedirect("error.jsp"); } } else{ response.sendRedirect("error.jsp"); }}catch(exceptione){ e.printstacktrace(); } finally{ rs.close(); stmt.close(); dbconn.close(); } %> 登陆成功界面 登陆成功,欢迎您! datenow=newdate(); dateFormatmediumdateFormat=dateFormat.getdatetimeinstance(dateFormat.medium,dateFormat.medium); %> 登陆失败界面 登陆失败,您输入的用户名或者密码不正确! 篇三:最新模板.jsp 临河小学教学设计
本文来源:https://www.2haoxitong.net/k/doc/5aa20b4a6394dd88d0d233d4b14e852459fb3943.html
文档为doc格式