Jsp--tomcat-mysql Web page Removal

Source: Internet
Author: User

Deletestudentjsp.jsp page Code

<%@ page language= "java" contenttype= "text/html; charset=gb2312 "pageencoding= "UTF-8"%><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >border-right: #89d4f8 1px solid;       Border-top: #89d4f8 1px solid; Border-left: #89d4f8 1px solid"cellspacing=0 cellpadding=70 align=center bgcolor= #ffffff border=0> <tbody> <tr> <td heigh t=26>&nbsp;&nbsp; Delete Student information </td> </tr> <tr> <td heigh T=1 bgcolor= #89d4f8 > </td> </tr> </tbody> </table> <!--post Data--<form name= "Messages" method= "POST" action= "after_deletestudent.jsp" > <table width= "a" lign= "center" border= "0" > <tr> <td height=26>&nbsp;&nbsp;&nbsp;</                  td> </tr> <tr> <td width= "267" > by school Number removed: </td>               <td><input type= "text" name= "Stuid" ></td> </tr> <TR>           &LT;TD width= "" ></td> <td><input type= "Submit" value= "Delete" ></td>      </TR>   </table> </form></body>

after_deletestudent.jsp Code

<%@ page language= "Java"Import= "Java.util.*"Import= "Com.mysql.jdbc.Driver"Import= "Java.sql.*"ContentType= "text/html;charset=gb2312"pageencoding= "UTF-8"%><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >Connection Conn;       Statement Stat; //set the URL of the connection, where student is the database nameString url= "Jdbc:mysql://localhost:3306/student"; //I am using the free install version of MySQL, User: root, Password: ZhangweijieString username= "Root"; String Password= "Zhangweijie"; //get deletestudentjsp.jsp page post come on Stuid        intStuid=integer.parseint (Request.getparameter ("Stuid")); Try{       //registering the JDBC driverClass.forName ("Com.mysql.jdbc.Driver"); }       Catch(ClassNotFoundException ex) {out.println ("Driver not Found!" "); }       //Open a database connectionConn=drivermanager.getconnection (URL, userName, password); Try{stat=conn.createstatement (); //perform a delete operation           intIsok=stat.executeupdate ("Delete from Student_info where stuid=" +stuid+ ""); if(isok>0) {out.println ("Delete succeeded!" "); }       }       Catch(SQLException ex) {out.println ("Delete failed!" "); }              finally{conn.close (); }        %> </body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.