[jboss-user] [Tomcat, HTTPD, Servlets & JSP] - exception thrown: passing an object from a bean to a JSP
congrio7
do-not-reply at jboss.com
Sat Nov 25 15:11:44 EST 2006
I have a class on /lib, here is:
package auxiliar;
public class Tabla {
public String oid;
public String ip;
public int frecuencia;
public int inicio;
public int fin;
public Tabla (String oid, String ip, int frecuencia, int inicio, int fin) {
this.oid = oid;
this.ip = ip;
this.frecuencia = frecuencia;
this.inicio = inicio;
this.fin = fin;
}
}
And then I have a bean like about this:
public class VerOid {
.......
public ArrayList ver () {
.......
ArrayList salida = new Arraylist();
...
while( rs.next() ) {
salida.add(new Tabla(_oid, _ip, _frecuencia, _inicio, _fin));
......
And at last, I have a JSP like this:
<jsp:useBean id="id1" scope="session" class="bean.VerOid"/>
<%
ArrayList d = id1.ver();
out.println( d.size());
///////////
out.println( ( (Tabla) (d.get(0)) ).oid );
////////
ArrayList ff = new ArrayList();
ff.add(new Tabla ("1.1.","127.",3,4,5));
out.println( ( (Tabla) ff.get(0) ).frecuencia );
%>
d.size no problem
With ff neither.
But out.println( ( (Tabla) (d.get(0)) ).oid ); thrown an exception java.lang.ClassCastException and I don't know why.
I have JDK 1.4.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988566#3988566
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988566
More information about the jboss-user
mailing list