Boa galera boa tarde a todos,
Assunto paginação:
Temos poucos recursos, certo?
Tentei utilizar as taglib ( display e Page ) sem sucesso ( caso algum amigo tenha um exemplo que possa me passar agradeço valmir@shelter.inf.br ).
Recentemente consegui um código bem legal e fácil, nem tudo na vida são rosas… tem uma parte no código que ainda não resolvi e solicito aos amigos ajuda.
Estou recebendo a clausula and por request.getParameter , qual o erro?
Quando clicko no link para o próximo grupo de dados, a pagina fica em branco come se não tivesse dados … Melhor não passa a String . Teria solução para isso?
Pensei em que, ao invés de receber a passar direto para query, fazer o seguinte armazenar e daí passar para query… mais infelizmente não sei como fazer, os amigos poderiam me ajudar?
[code]
<%@page contentType=“text/html”%>
<%@page pageEncoding=“UTF-8”%>
<%@ page language=“java” %>
<%@ page import=“java.sql.*”%>
<%@ page import=“java.sql.Date”%>
<%–
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library… action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
–%>
<%–
<%@taglib uri=“http://java.sun.com/jsp/jstl/core” prefix=“c”%>
–%>
<%
String setor2 = (String) request.getParameter("grupo");
%>
<%
//Connection con = null;
Statement st = null;
ResultSet rs = null;
ResultSet rst = null;
try {
String setor = (String) request.getParameter("grupo");
String setor3 = (String) request.getParameter("grupo");
//String dsn = “jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=D:/Atn/DB/RJJ0802.mdb”;
//String usuario = “”;
//String senha = “”;
//String sql = “”;
//Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”).newInstance();
//Connection con = DriverManager.getConnection(dsn,usuario,senha);
String url="jdbc:mysql://localhost:3306/shelter";
Class.forName("org.gjt.mm.mysql.Driver");
Connection con = DriverManager.getConnection(url, "root", "1272");
%>
<%
st = con.createStatement();
rst = st.executeQuery
//(“Select * from Ramal”);
//("Select Sum(IIf(CRJJ02.tipo = 0, 1, 0)) As efetuadas, Sum(IIf(CRJJ02.tipo = 1, 1, 0)) As recebidas From Ramal, CRJJ02 " +
//"where Ramal.ramal = CRJJ02.origem And grupo = '"+ setor3 +"' And data = date() ");
("select count(recebida) as recebidas, count(n_discado) as efetuadas From tb_ligacoes L, ramal R " +
"where R.ramal = L.ramal And R.grupo = '"+ setor3 +"' ");
while (rst.next()){
%>
<%
st = con.createStatement();
rs = st.executeQuery
// (“Select ramal, Sum(IIf(CRJJ02.tipo = 0, 1, 0)) As efetuadas, Sum(IIf(CRJJ02.tipo = 1, 1, 0)) As recebidas From Ramal, CRJJ02 " +
// “where Ramal.ramal = CRJJ02.origem And grupo = '”+ setor +”’ And data = date() Group by Ramal.ramal");
("select R.ramal, count(recebida) as recebidas, count(n_discado) as efetuadas From tb_ligacoes L, ramal R " +
"where R.ramal = L.ramal And R.grupo = '"+ setor +"' Group by R.ramal ");
%>
<table width="100%">
<tr>
<td width="2%" height="125"> </td>
<td width="90%"><fieldset>
<legend>Sumário por ramal referente ao setor:<span class="style3"> <%=setor2%></span></legend>
Ligações Efetuadas |
Ligações Recebidas |
Ligações não atendidas |
||
<%= rst.getString("efetuadas") %> |
<%= rst.getString("recebidas") %> |
Ramal |
Ligações Efetuadas |
Ligações Recebidas |
%>
<% out.print ( ""+grupo+""); %> |
<%= rs.getString("efetuadas") %> |
<%= rs.getString("recebidas") %> |
<p> </p>
<p> </p>
</table>
<%
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
if (rst != null) rst.close();
if (rs != null) rs.close();
if (st != null) st.close();
// if (con != null) con.close();
}
%>
[/code]
ou caso alguem tenha um codigo exemplo, passe por favor para o e-mail acima.
Grato