olá galera, fiz um jsp junto com um form em html q quero salvar seus dados no banco mysql e nao estou coinseguindo fazer funcionar a principio nao gera erro mais nao da o insert no banco , e já coloquei o driver do mysql no tomcat segue o codigo
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Cadastro - Bad Evil </title>
</head>
<body>
<form method="post" action="teste.jsp" style="width: 452px" class="style1">
<label id="Label1"> <br />
<fieldset name="Group1" style="height: 126px">
<legend>
<div style="position: absolute; width: 100px; height: 21px; z-index: 1; left: 122px; top: 73px" id="layer2">
Login:</div>
Criar Conta:</legend>
<label id="Label1"> <div style="position: absolute; width: 200px; height: 20px; z-index: 2; top: 107px; left: 230px" id="layer6">
<input name="password" type="password" style="width: 200px" /></div>
<div style="position: absolute; width: 200px; height: 20px; z-index: 2; top: 73px; left: 230px" id="layer5">
<input name="login" type="text" style="width: 200px" /></div>
<br />
<br />
<div style="position: absolute; width: 100px; height: 21px; z-index: 1; left: 122px; top: 109px; bottom: 662px" id="layer3">
Password:</div>
<div style="position: absolute; width: 100px; height: 21px; z-index: 1; left: 122px; top: 145px" id="layer4">
E-mail:</div>
<div style="position: absolute; width: 200px; height: 20px; z-index: 2; top: 142px; left: 230px" id="layer7">
<input name="email" type="text" style="width: 200px" /></div>
</label></fieldset> <input name="ok" type="submit" value="Cadastrar" />
<input name="limpar" type="reset" value="Limpar" /><label id="Label2"><br />
</label> </label> <label id="Label3"> </label></form>
</body>
</html>
%@page import="java.sql.*"%>
<%
try
{
String nome = request.getParameter( "login" );
String senha = request.getParameter( "password" );
String email = request.getParameter( "email" );
Driver d = (Driver)Class.forName("com.mysql.jdbc.Driver").newInstance();
String URL = "jdbc:mysql://localhost:3307/bad_bad";
Connection con = DriverManager.getConnection(URL, "root", "123");
}
catch(Exception e)
{
e.printStackTrace();
}
String sql = "INSERT INTO login (login,password,vitorias,email) VALUES (?,?,?,?)";
try
{
PreparedStatement ps = con.prepareStatement(sql);
ps.setString(1,nome);
ps.setString(2,senha);
ps.setInt(3,0);
ps.setString(4,email);
ps.executeUpdate();
ps.close();
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
try
{
if (con != null)
{
con.close();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
%>