Home > database >  Why can't insert
Why can't insert

Time:09-28

NewFile
<% @ page language="Java" contentType="text/HTML. Charset=utf-8 "pageEncoding=" utf-8 "% & gt; <meta charset="utf-8" & gt; Insert the title here <body> & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; Student management system & lt;/h1 & gt;

NewFile1
<% @ page language="Java" contentType="text/HTML. Charset=utf-8 "pageEncoding=" utf-8 "% & gt; <meta charset="utf-8" & gt; Insert the title here <body> Student id & lt; Input type="text name=" sno & gt;"
Name & lt; Input type="text name=" name "& gt;
Gender & lt; Input type="text name=" sex "& gt;
Address & lt; Input type="text name=" address "& gt;
Telephone & lt; Input type="text name=" phone "& gt;
Professional & lt; Input type="text name=" sdept & gt;"
& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;

Web.xml
<? The XML version="1.0" encoding="utf-8"?> JDBC Index. Html Index. Htm Index. Jsp Default. Html Default. Htm Default. Jsp Infortion JDBC. LURU Infortion /Infortion

LURU. Java
Package JDBC. import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; The import javax.mail. Servlet. RequestDispatcher; The import javax.mail. Servlet. ServletConfig; The import javax.mail. Servlet. ServletException; The import javax.mail. Servlet. The annotation. WebServlet; The import javax.mail. Servlet. HTTP. HttpServlet; import javax.servlet.http.HttpServletRequest; The import javax.mail. Servlet. HTTP. HttpServletResponse; The import student. Student;/* * * the Servlet implementation class Insert */@ WebServlet ("/LURU ") public class LURU extends the HttpServlet {private static final long serialVersionUID=1 l;/* * * @ see HttpServlet# HttpServlet () */public LURU () {super ();//TODO Auto - generated constructor stub}/* * * @ see Servlet# init (ServletConfig) */public void init (ServletConfig config) throws ServletException {. Super init (config); Try {class.forname (". Com. Mysql. JDBC Driver "); } the catch (Exception e) {}}/* * * @ see HttpServlet# doGet (it request, HttpServletResponse response) */protected void doGet (it request, HttpServletResponse response) throws ServletException, IOException {request. SetCharacterEncoding (" utf-8 "); response.setContentType("text/html; charset=utf-8"); Student stu=new student (); Request. SetAttribute (" student ", stu); String sno=request. The getParameter (" sno "); String name=request. The getParameter (" name "); nullnullnull
  • Related