hi
i have a problem with using together jsp and wamp.i use tomcat and wamp server.i put mysql connector 5.0.1 in tomcat web-inf.i create airline database and login table in wamp.my jsp program put tomcat root.
register.jsp run inserting data from my form no error are outputted although the records are not being inserted login table in airline database in wamp.my code is
register.jsp
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[
www.w3.org];
<html xmlns="[
www.w3.org];
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
</style>
</head>
<body>
<h1>Register Here:</h1>
<form action="insert.jsp" method="post">
<p><strong>Bc Number:</strong>
<input type="text" name="username" />
</p>
<p><strong>Password: </strong>
<input type="password" name="password" />
</p>
<input type="submit" name="submit" value="Submit" />
<p></p>
</form>
</body>
</html>
insert.jsp
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[
www.w3.org];
<html xmlns="[
www.w3.org];
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head><%@ page import="java.sql.*" %>
<body>
<p align="left">
<% String username=request.getParameter("username"
;
String password=request.getParameter("password"
;
%>
<% int i=-1;
try{
Class.forName("com.mysql.jdbc.Driver"
;
Connection con =DriverManager.getConnection("jdbc:mysql://localhost:3306/airline"
;
Statement stmt =con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sqlStatement= "INSERT INTO login(username,password) VALUES('"+username+"','"+password+"')";
i=stmt.executeUpdate(sqlStatement);
}catch(SQLException e){
e.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}
if(i==1)
response.sendRedirect("Login.jsp"
;
else
response.sendRedirect("insert.jsp"
;
%>
</body>
</html>