@Michael.Jordan escreveu:
<div class="form-group"> <label for="txtGenro">Gênero</label> <select name="genero.id"> <option value=""></option> <option value="Acao">Ação</option> <option value="Aventura">Aventura</option> <option value="Terror">Terror</option> </select> </div>
public List<Filme> buscarTodos() { List<Filme> filmes = new ArrayList<Filme>(); final String SQL_LISTAR = "SELECT id,nome FROM genero"; try { fabricaConexoes.abrir(); //Criando o statment PreparedStatement stmt = fabricaConexoes.getConexao().prepareStatement(SQL_LISTAR); //Executando a busca ResultSet resultado = stmt.executeQuery(); while(resultado.next()){ Filme filme = new Filme(); filme.setId(resultado.getLong("id")); filme.setNome(resultado.getString("nome")); // AQUI QUERO PEGAR O VALOR DO SELECT SELECIONADO PARA ADICIONAR NO BANCO //Adicionando o filme na lista filmes.add(filme); } //Fechando o ResultSet resultado.close(); } catch (Exception e) { e.printStackTrace(); // Exibe mensagem de erro throw new RuntimeException(); }finally { fabricaConexoes.fechar(); } return filmes; }
Mensagens: 1
Participantes: 1