主题:[讨论]jsp+mysql无法添加页面上的数据到数据库
JAVABEAN是以前用过的,可以用,运行时也没有什么错误提示.但是就是不能添加数据到数据库,劳驾那位高人指点一二....谢谢!!!
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*"%>
<jsp:useBean id="db" scope="page" class="opendb.opendb"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>student register</title>
</head>
<body>
<center>
<%
ResultSet rs=null;
Connection conn=null;
conn=db.getConn();
String UFamilyName=request.getParameter("UFamilyName");
String UFirstName=request.getParameter("UFirstName");
String UBirth=request.getParameter("UBirth");
String UNationality=request.getParameter("UNationality");
String UAddress=request.getParameter("UAddress");
String UContactInfo=request.getParameter("UContactInfo");
String UEmail=request.getParameter("UEmail");
String UTele=request.getParameter("UTele");
String USex=request.getParameter("USex");
String faculty=request.getParameter("faculty");
rs=db.executeSQL("insert into student values('"+UFamilyName+"','"+UFirstName+"','"+UBirth+"','"+UNationality+"','"+UAddress+"','"+UContactInfo+"','"+UEmail+"','"+UTele+"','"+USex+"','"+faculty+"')");
%>
<p> <font> <%=UFirstName%> </font> :your information has been insert into database,</p>
<p align="center"><a href="homepage.jsp">return to homepage</a></p>
</body>
</html>
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*"%>
<jsp:useBean id="db" scope="page" class="opendb.opendb"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>student register</title>
</head>
<body>
<center>
<%
ResultSet rs=null;
Connection conn=null;
conn=db.getConn();
String UFamilyName=request.getParameter("UFamilyName");
String UFirstName=request.getParameter("UFirstName");
String UBirth=request.getParameter("UBirth");
String UNationality=request.getParameter("UNationality");
String UAddress=request.getParameter("UAddress");
String UContactInfo=request.getParameter("UContactInfo");
String UEmail=request.getParameter("UEmail");
String UTele=request.getParameter("UTele");
String USex=request.getParameter("USex");
String faculty=request.getParameter("faculty");
rs=db.executeSQL("insert into student values('"+UFamilyName+"','"+UFirstName+"','"+UBirth+"','"+UNationality+"','"+UAddress+"','"+UContactInfo+"','"+UEmail+"','"+UTele+"','"+USex+"','"+faculty+"')");
%>
<p> <font> <%=UFirstName%> </font> :your information has been insert into database,</p>
<p align="center"><a href="homepage.jsp">return to homepage</a></p>
</body>
</html>