protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int id = Integer.valueOf(request.getParameter("id")); Connection conexao = null; try { conexao = AbstractConnectionFactory.getConexao(); OrcamentoDao orcamentoDao = new OrcamentoDao(conexao); orcamentoDao.excluirOrcamento(id); write(response, "Orcamento excluido com sucesso"); } catch (ClassNotFoundException e) { e.printStackTrace(); write(response, "ERRO codigo CNFE10 " + e.getMessage()); } catch (SQLException e) { e.printStackTrace(); write(response, "ERRO codigo SQLE10 " + e.getMessage()); } finally { try { conexao.close(); } catch (SQLException e) { e.printStackTrace(); write(response, "ERRO codigo SQLE10 " + e.getMessage()); } } }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String email = request.getParameter("email"); String assunto = request.getParameter("assunto"); String mensagem = request.getParameter("mensagem"); String resultado = "true"; Connection conexao = null; try { conexao = AbstractConnectionFactory.getConexao(); EmpresaDao empresaDao = new EmpresaDao(conexao); Empresa empresa = empresaDao.get(); Email.enviarEmail( empresa.getEmail(), empresa.getSenha(), email, assunto, HtmlMensagem.getMensagemEnviarEmail(mensagem)); write(response, resultado); } catch (AddressException e) { e.printStackTrace(); write(response, "ERRO codigo AE07 " + e.getMessage()); } catch (SendFailedException e) { e.printStackTrace(); write(response, "ERRO codigo SFE07" + e.getMessage()); } catch (MessagingException e) { e.printStackTrace(); write(response, "ERRO codigo ME07 " + e.getMessage()); } catch (SQLException e) { e.printStackTrace(); write(response, "ERRO codigo SQL07 " + e.getMessage()); } catch (ClassNotFoundException e) { e.printStackTrace(); write(response, "ERRO codigo CNFE07 " + e.getMessage()); } finally { try { conexao.close(); } catch (SQLException e) { e.printStackTrace(); write(response, "ERRO codigo SQL207 " + e.getMessage()); } } }