Spring HTTP Status 400

0 respostas
F
Estou tentando desenvolver aplicação com Spring Framework, porém toda vez que tendo adicionar um contato dar o seguinte erro:HTTP Status 400 - The request sent by the client was syntactically incorrect. Minha JSP
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="caelum" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Agenda Contato</title>
<link href="css/jquery.css" rel="stylesheet">
<script src="js/jquery.js"></script>
<script src="js/jquery-ui.js"></script>
</head>
<body>
 <c:import url="cabecalho.jsp"/>
  <form  action="adicionaContato" method="post"> <br/>
  Nome:           <input type="text" name="nome"><br/>
  EMAIL:          <input type="text" name="email"><br/>
  ENDEREÇO:       <input type="text" name="endereco"><br/>
  Data Nascimento:<caelum:campoData id="dataNascimento" /><br />
  <input type="submit" value="GRAVAR">
  </form>
  <c:import url="rodape.jsp" />
</body>
</html>
A classe Controller
@Controller
public class ContactControler {
    private final ContatoDao dao;
    
    @Autowired
	public ContactControler(ContatoDao dao){
		this.dao = dao;
	}
    
    @RequestMapping("novoContato")
    public String form(){
    	return "contato/formulario";
    }
    @RequestMapping("adicionaContato")
    public String adiciona(Contato contato){
    	dao.adiciona(contato);
		return "contato/adicionado";
    }
}
Meu Dao
@Repository
public class ContatoDao {
	private Connection connection;

	@Autowired
	public ContatoDao(DataSource dataSource) {

		try {
			this.connection = dataSource.getConnection();
		} catch (SQLException e) {
			throw new RuntimeException(e);
		}
	}
	
	public void adiciona(Contato contato) {
		String sql = "insert into contatos(nome,email,endereco,dataNascimento)values(?,?,?,?)";
		try {
			PreparedStatement smt = connection.prepareStatement(sql);
			smt.setString(1, contato.getNome());
			smt.setString(2, contato.getEmail());
			smt.setString(3, contato.getEndereco());
			smt.setDate(4, new Date(contato.getDataNascimento()
					.getTimeInMillis()));

			smt.execute();
			smt.close();
		} catch (SQLException e) {
			throw new RuntimeException(e);
		}

	}
}
Se alguém puder dar uma força agradeço
Criado 20 de junho de 2014
Respostas 0
Participantes 1