Pesquisei, mas não sei se resolveria o meu caso. Vamos por partes:
Estou construindo uma grid dinamica. Seghue o Código:
[code]<%@ page language=“java” contentType=“text/html; charset=ISO-8859-1”
pageEncoding=“ISO-8859-1”%>
<%@ page import = “java.io.,java.util.,java.net.,java.sql.,javax.servlet.,javax.servlet.http.”
%>
<jsp:useBean id =“cnx” class=“util.conexao”/>
<jsp:useBean id =“rows” class=“util.GetRowCount”/>
<%
try{
String strSql="SELECT * FROM tab_tipo_logradouro";//request.getParameter("sql");
// Conexao1 cnx = new Conexao1();
int nRows = 2;//Integer.parseInt(request.getParameter("rows"));
int nBotao = 0;
ResultSet rs = cnx.ExecutaSQL(strSql);
ResultSetMetaData nCols = rs.getMetaData();
int nPaginas = 1;
int intTotalRows=3;
// if(nRows < (intTotalRows+1))
// nPaginas = 1;
// else
nPaginas = (Math.abs(intTotalRows/nRows))+1;
String retorno[];
retorno = new String[nRows];
//System.out.print(nCols.getColumnCount());
rs.first();
for(int j = 0;j<(nPaginas);j++)
{
//if (rs.isLast()==false)
//{
retorno[j] = "";
retorno[j] = retorno[j] + "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'> " + "\n";
retorno[j] = retorno[j] + "<html>" + "\n";
retorno[j] = retorno[j] + "<head>" + "\n";
retorno[j] = retorno[j] + "<script type='text/javascript' src='../js/Bs_Misc.lib.js'></script> " + "\n";
retorno[j] = retorno[j] + "<script type='text/javascript' src='../js/Bs_DataGrid.class.js'></script> " + "\n";
retorno[j] = retorno[j] + "<link rel='stylesheet' href='../css/style1.css'> " + "\n";
retorno[j] = retorno[j] + "<script type='text/javascript'> " + "\n";
retorno[j] = retorno[j] + "function init() { " + "\n";
retorno[j] = retorno[j] + "myGrid = new Bs_DataGrid('myGrid'); " + "\n";
retorno[j] = retorno[j] + "myGrid.bHeaderFix = false; " + "\n";
int i = 0;
String strArray="";
String strTitulo="";
String tretorno="";
for(int X = 0;X<(nRows);X++)//while(rs.next())
{
//rs.first();
strTitulo="";
for (i=0;i<(nCols.getColumnCount());i++)
{
if (nCols.getColumnCount()==1)
{
strArray="'"+ rs.getString(nCols.getColumnName(i+1))+"'";
strTitulo = "{text:'" + nCols.getColumnName(i+1) + "', align:'center'}";
}
else{
if (i==nCols.getColumnCount()-1)
{
strArray=strArray+"'"+ rs.getString(nCols.getColumnName(i+1))+"'";
strTitulo = strTitulo + "{text:'" + nCols.getColumnName(i+1) + "', align:'center'}";
}
else{
strArray=strArray+"'"+ rs.getString(nCols.getColumnName(i+1))+"',";
strTitulo = strTitulo + "{text:'" + nCols.getColumnName(i+1) + "', align:'center'},";
}
}
}
//Retorna o ponteiro do contador para zero
tretorno = tretorno + "data[data.length] = new Array(" + strArray + "); " + "\n";
i=0;
strArray="";
if (rs.isLast()==false )
{
rs.next();
}
else
{
X++;
}
}
retorno[j] = retorno[j] + "var header = new Array("+strTitulo+"); " + "\n";
retorno[j] = retorno[j] + "var data = new Array(); " + "\n";
retorno[j] = retorno[j] + tretorno;
retorno[j] = retorno[j] + "myGrid.setHeaderProps(header); " + "\n";
retorno[j] = retorno[j] + "myGrid.setData(data); " + "\n";
retorno[j] = retorno[j] + "myGrid.drawInto('myGridDiv'); " + "\n";
retorno[j] = retorno[j] + "} " + "\n";
retorno[j] = retorno[j] + "</script> " + "\n";
retorno[j] = retorno[j] + "</head> " + "\n";
retorno[j] = retorno[j] + " <body onLoad='init();'> " + "\n";
retorno[j] = retorno[j] + " <div id='myGridDiv'></div> " + "\n";
retorno[j] = retorno[j] + "</body> " + "\n";
}
cnx.FechaConexaoBD();
%>
|
|
<%
}
catch(Exception e)
{
out.print( “”+ e);
}
%>
<TR>
<form name="form1" method="post" action="grid">
<TD><INPUT type=button value="|<" name=bt_primeiro></TD>
<TD><INPUT type=button value="< " name=bt_anterior></TD>
<TD><INPUT type=button value="> " name=bt_proximo></TD>
<TD><INPUT type=button value=">|" name=bt_ultimo></TD></TR></TABLE></TD></TR></TABLE></P>
</form>
[/code]
O que eu preciso?
em
[quote]
|
|
|
|
|
[/quote]
eu precisaria, conforme o o botão clicado, alterar
[quote]
[/quote]
Isto porque o array retorno[nBotao] conteria o que eu preciso para a paginação da grid.