Ola pessoal…
Estou fazendo uma página que retorna duas tabelas…departamentos e empregados…existe um relacionamento entre essas tabelas que eh pelo numero do departamento… o que eu quero eh que quando o usuario selecione um departamentoa pagina se atualize
Da um erro de sql… java.sql.SQLException: Conjunto de Resultados Esgotado
Segue o codigo… por favor me ajudem…
tks
<%@ page contentType=“text/html;charset=windows-1252”%>
<%@ taglib uri=“<a href="http://java.sun.com/jsf/html">http://java.sun.com/jsf/html</a>” prefix=“h”%>
<%@ taglib uri=“<a href="http://java.sun.com/jsf/core">http://java.sun.com/jsf/core</a>” prefix=“f”%>
<%@ page import=“conexao.Conexao”%>
<%@ page import=“java.sql.*”%>
<table cellspacing="0" border="1" width="700" align="center">
<caption>DEPARTAMENTOS</caption>
<tr>
<th scope="col">SELECIONAR</th>
<th scope="col">DEPTO Nº</th>
<th scope="col">DEPARTAMENTO</th>
<th scope="col">INDETIFICAÇÃO DO GERENTE</th>
</tr>
<%
int contador = 0;
int quantidade = 0;
Conexao conexao = new Conexao();
String cod;
ResultSet rs = conexao.execSelect("select * from departamentos WHERE dept_id = " + request.getParameter("idDepto") );
rs.next();
while (contador <= quantidade && (!rs.isAfterLast())) {
out.println("<tr class=‘alt’’>
out.println("
out.println("<td width='12%‘align=‘center’ border=‘1’’>" + rs.getObject(“dept_name”) + “</font)”);
out.println("<td width='10%‘align=‘center’ border=‘1’’> " + rs.getObject(“dept_mgr”) + “</font)”);
rs.next();
}
%>
<table cellspacing="0" border="1" width="700" align="center">
<caption>FUNCIONARIOS</caption>
<tr>
<th scope="col">SELECIONAR</th>
<th scope="col">MATRICULA</th>
<th scope="col">NOME</th>
<th scope="col">SOBRENOME</th>
<th scope="col">EMAIL</th>
<th scope="col">TELEFONE</th>
<th scope="col">SALARIO</th>
<th scope="col">IDENTIIFCAÇÃO DO GERENTE</th>
<th scope="col">DEPTO Nº</th>
</tr>
<%
int contadorr = 0;
int quantidadee = 0;
Conexao conexaoo = new Conexao();
String codd;
ResultSet rss = conexaoo.execSelect("select * from funcionarios where dept_id=" + request.getParameter("idDepto") + " ORDER BY id");
rss.next();
while (contadorr <= quantidadee && (!rss.isAfterLast())) {
out.println("<tr class=‘alt’’>
out.println("<td width='12%‘align=‘center’ border=‘1’’>" + rss.getObject(“id”) + “</font)”);
out.println("<td width='12%‘align=‘center’ border=‘1’’>" + rss.getObject(“nome”) + “</font)”);
out.println("<td width='10%‘align=‘center’ border=‘1’’> " + rss.getObject(“sobrenome”) + “</font)”);
out.println("<td width='12%‘align=‘center’ border=‘1’’>" + rss.getObject(“email”) + “</font)”);
out.println("<td width='12%‘align=‘center’ border=‘1’’>" + rss.getObject(“telefone”) + “</font)”);
out.println("<td width='12%‘align=‘center’ border=‘1’’>" + rss.getObject(“salario”) + “</font)”);
out.println("<td width='12%‘align=‘center’ border=‘1’’>" + rss.getObject(“gerente”) + “</font)”);
out.println("<td width='12%‘align=‘center’ border=‘1’’>" + rss.getObject(“dept_id”) + “</font)”);
rss.next();
}
%>
</body>