Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What could be wrong ?? Rowset question

Status
Not open for further replies.

RicardoPereira

Programmer
Jun 3, 2003
255
PT
I dont know what could be wrong with my jsp page.
I want to build a page that display a limite number of records like the one in this forum.
But i dont know what could be wrong with my code.
Could anybody help me with this?

My code is:

....

<%
/**Incialização da variavel de controlo da pagina da Array List */
int p = pagina.getPagina();

/** Incialização das variáveis de controlo da ArrayList de Produtos */
int pagina = 0;
int totPaginas=0;
int registosPagina = 13;


ArrayList listaCan=pesquisas.getCanalVenda(XCVND);

/** Calculo do Total Páginas produzidas pela ArrayList */
totPaginas = listaCan.size() / registosPagina;
if ( (registosPagina*totPaginas) != listaCan.size())
{totPaginas++;}

/** Definição do registo Inicial e Final a visualizar na pagina actual */
int regInicial = p * registosPagina;
int regFinal = regInicial + registosPagina;

/** Definição do último registo da ArrayList com o registo Final a visualizar,
caso este último já seja superior ao tamanho da ArrayList */
if (regFinal > listaCan.size()) {regFinal=listaCan.size();}

for( int x=regInicial;x<regFinal.size();x++)
{
xiol01p xiol=(xiol01p) listaCan.get(x);
out.println(&quot;<tr bgcolor='#ffffff'>&quot; +
&quot;<td><font color='#9b301c'><b><p align='center'>&quot; + xiol.getXCVND() + &quot;</p></b></td><td class='smallertext'><p align='center'>&quot; + xiol.getXNENC() + &quot;</p></td>&quot; +
&quot;<td class='smallertext'><p align='center'><p align='center'>&quot; + xiol.getXDEXP() + &quot;</p></td><td class='smallertext'><p align='center'>&quot; + xiol.getXNACT() + &quot;</p></td>&quot; +
&quot;<td class='smallertext'><p align='center'>&quot; + xiol.getXNGT() + &quot;</p></td></tr>&quot;);

}

/** Link para visualização da página de registos anterior */
if (p > 0) {
out.println(&quot;<TH><a href=\&quot;pesquisa_c_venda_qry.jsp?pagina=&quot; + ( p-1) + &quot;\&quot;><img BORDER='0' src='images/anterior.gif'></a>&quot;);}

/** Link para visualização da página de registos seguinte */
p++;
if ( p < totPaginas) {
out.println(&quot;<TH><a href=\&quot;pesquisa_c_venda_qry.jsp?pagina=&quot; + p + &quot;\&quot;><img BORDER='0' src='images/seguinte.gif'></a>&quot;);}


%>

....



The error is:

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: -1 in the jsp file: null

Generated servlet error:
[javac] Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
[javac] C:\tomcat\webserver\work\Standalone\localhost\_\IOL\users\Pesquisas\pesquisa_c_venda_qry_jsp.java:209: pagina is already defined in _jspService(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
[javac] int pagina = 0;
[javac] ^
[javac] C:\tomcat\webserver\work\Standalone\localhost\_\IOL\users\Pesquisas\pesquisa_c_venda_qry_jsp.java:229: int cannot be dereferenced
[javac] for( int x=regInicial;x

-----------&quot;&quot;-----------

Thank you all
 
>> I dont know what could be wrong with my jsp page.

[red]pagina is already defined in _jspService[/red](javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
[javac] int pagina = 0;


If your not going to bother to learn to read and understand compilation error messages I don’t know how far your going to get developing software.

&quot;But, that's just my opinion... I could be wrong.&quot;

-pete
 
lol,

man, my doubt is for the second error message.

C:\tomcat\webserver\work\Standalone\localhost\_\IOL\users\Pesquisas\pesquisa_c_venda_qry_jsp.java:229: int cannot be dereferenced
[javac] for( int x=regInicial;x


I don't know what to do to resolve this. That is why i post the question.
 
int regFinal = regInicial + registosPagina;
for( int x=regInicial;x<[red]regFinal.size()[/red];x++)

There is no size() method of type int


-pete
 
I do agree with palbano.You should try to understand compilation error messages. The best way would be to refer to the servlet generated by the container, e.g., in this case it is
C:\tomcat\webserver\work\Standalone\localhost\_\IOL\users\Pesquisas\pesquisa_c_venda_qry_jsp.java

Now go through the code.Concentrate on the lines indicated (viz.,209, 229).It would certainly give you an indication as to what has gone wrong in your jsp.

Many a times it also helps to learn good coding practices.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top