RicardoPereira
Programmer
I'am trying to display all the records from a table to my jsp page without requesting parameters (without forms), but i'am getting always the same erros message.
org.apache.jasper.JasperException: ControloBD.ControloQualidadeBD.getTblErros()Ljava/util/ArrayList;
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
...
I have an jsp file with a bean that access a class file.
Jsp file:
---------
<%@page contentType="text/html" import="java.util.ArrayList, entidades.*" %>
<jsp:useBean id="pesquisas" scope="request" class="ControloBD.ControloQualidadeBD" />
<HR><center><table border=0 cellspacing=1 cellpadding=2 bgcolor = "#eeeeee">
<tr bgcolor="#eeeeee"><td class="smallerheader"><font class="smallerheader">
<b>Código Erro</b></font></td><td class="smallerheader"><font class="smallerheader"><font class="smallerheader">
<b>Descrição Erro</b></font></td></tr>
<%
ArrayList listaTErro=pesquisas.getTblErros();
for( int x=0;x<listaTErro.size();x++)
{
Tbl_Erros TErro=(Tbl_Erros) listaTErro.get(x);
out.println("<tr bgcolor='#ffffff'>" +
"<td><p align='center'>" + TErro.getQ3CODERRO() +
"</p></td><td class='smallertext'><font color='#9b301c'><b><p align='center'>" + TErro.getQ3DESCERRO() + "</p></b></td></tr>"
}
%>
</table></center><HR>
Method getTblErros in class ControloQualidadeBD
-----------------------------------------------
public ArrayList getTblErros() throws SQLException {
ArrayList res=new ArrayList();
Statement stmt = con.createStatement();
ResultSet rslt = stmt.executeQuery("select Q3CODERRO, Q3DESCERRO from Tbl_Erros"
while (rslt.next()) {
res.add(new Tbl_Erros(rslt.getString(1), rslt.getString(2)));
}
return res;
}
class Tbl_Erros
---------------
package entidades;
public class Tbl_Erros {
String Q3CODERRO;
String Q3DESCERRO;
public Tbl_Erros() {
}
public Tbl_Erros(String Q3CODERRO, String Q3DESCERRO) {
this.Q3CODERRO=Q3CODERRO;
this.Q3DESCERRO=Q3DESCERRO;
}
public String getQ3CODERRO() {
return Q3CODERRO;
}
public String getQ3DESCERRO() {
return Q3DESCERRO;
}
}
----------------------------------------------------
What should be the cause of this error?
Thanks
Ricardo Pereira
org.apache.jasper.JasperException: ControloBD.ControloQualidadeBD.getTblErros()Ljava/util/ArrayList;
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
...
I have an jsp file with a bean that access a class file.
Jsp file:
---------
<%@page contentType="text/html" import="java.util.ArrayList, entidades.*" %>
<jsp:useBean id="pesquisas" scope="request" class="ControloBD.ControloQualidadeBD" />
<HR><center><table border=0 cellspacing=1 cellpadding=2 bgcolor = "#eeeeee">
<tr bgcolor="#eeeeee"><td class="smallerheader"><font class="smallerheader">
<b>Código Erro</b></font></td><td class="smallerheader"><font class="smallerheader"><font class="smallerheader">
<b>Descrição Erro</b></font></td></tr>
<%
ArrayList listaTErro=pesquisas.getTblErros();
for( int x=0;x<listaTErro.size();x++)
{
Tbl_Erros TErro=(Tbl_Erros) listaTErro.get(x);
out.println("<tr bgcolor='#ffffff'>" +
"<td><p align='center'>" + TErro.getQ3CODERRO() +
"</p></td><td class='smallertext'><font color='#9b301c'><b><p align='center'>" + TErro.getQ3DESCERRO() + "</p></b></td></tr>"
}
%>
</table></center><HR>
Method getTblErros in class ControloQualidadeBD
-----------------------------------------------
public ArrayList getTblErros() throws SQLException {
ArrayList res=new ArrayList();
Statement stmt = con.createStatement();
ResultSet rslt = stmt.executeQuery("select Q3CODERRO, Q3DESCERRO from Tbl_Erros"
while (rslt.next()) {
res.add(new Tbl_Erros(rslt.getString(1), rslt.getString(2)));
}
return res;
}
class Tbl_Erros
---------------
package entidades;
public class Tbl_Erros {
String Q3CODERRO;
String Q3DESCERRO;
public Tbl_Erros() {
}
public Tbl_Erros(String Q3CODERRO, String Q3DESCERRO) {
this.Q3CODERRO=Q3CODERRO;
this.Q3DESCERRO=Q3DESCERRO;
}
public String getQ3CODERRO() {
return Q3CODERRO;
}
public String getQ3DESCERRO() {
return Q3DESCERRO;
}
}
----------------------------------------------------
What should be the cause of this error?
Thanks
Ricardo Pereira