Como fazer um JSP abrir os dados do DB vindos da Servlet abaixo…
[code]/*
- Pesquisar.java
- Created on 24 de Agosto de 2005, 09:28
- To change this template, choose Tools | Options and locate the template under
- the Source Creation and Management node. Right-click the template and choose
- Open. You can then make changes to the template in the Source Editor.
*/
/**
*
-
@author Eduardo Bregaida
*/
import java.io.;
import javax.servlet.http.;
import javax.servlet.;
import java.sql.;
import java.util.ArrayList;
import java.util.Collection;
import model.OrdemServico;
public class Pesquisar extends HttpServlet{
public void doGet (HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con = DriverManager.getConnection ( “jdbc:odbc:bd”," “,” ");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(“Select * from chamado order by Numero”);
Collection OrdemServico = new ArrayList();
while (rs.next()){
OrdemServico os = new OrdemServico();
os.setNumero(rs.getString("Numero"));
os.setsolic(rs.getString("solic"));
os.setdepto(rs.getString("depto"));
os.setdt_cham(rs.getString("dt_cham"));
os.seth_cham(rs.getString("h_cham"));
os.setmotivo(rs.getString("motivo"));
os.setdesc1(rs.getString("desc1"));
os.setdesc2(rs.getString("desc2"));
os.seth_inicio(rs.getString("h_inicio"));
os.seth_fim(rs.getString("h_fim"));
os.setdt_inicio(rs.getString("dt_inicio"));
os.setdt_fim(rs.getString("dt_fim"));
os.setprazo(rs.getString("prazo"));
os.settecnico(rs.getString("tecnico"));
os.setconcluido(rs.getString("concluido"));
os.setstatus(rs.getString("status"));
OrdemServico.add("os");
}
request.forward("/alteracao.jsp"); //Erro nessa linha...
}catch(Exception ex){
System.out.println(ex);
}
}
}
[/code]
[code]Página HTML q deve virar JSP
OSNúmero: .....
<font color="#CC99FF">....</font>Solicitante:<font color="#CC99FF"> .. </font><font color="#FFFFFF">
<input type="text" name="solic">
<font color="#CC99FF">.....</font> <input name="pesquisar" type="submit" value="Pesquisar">
<font color="#CC99CC">.............................................................................</font>
<input name="Excluir" type="Submit" value="Excluir">
<input type="Reset" value="Limpar">
…
[/code]Sou iniciante e estou com duvida… Já li diversos tutoriais, mas o conceito ta dificil de entrar…