Alguem da lista com experiencia em Beans? Estou tentando colocar um
exemplo simples pra correr,que peguei em um livro, mas sem sucesso.
O codigo do bean eh:
import java.util.*;
import java.io.*;
public class MultiValuedBean implements Serializable
{
//MultiValued property
private Vector list = new Vector(5);
public MultiValuedBean()
{
//build the list
list.addElement(new String("Bob") );
list.addElement(new String("Steve") );
list.addElement(new String("Christy") );
list.addElement(new String("Abby") );
list.addElement(new String("Luis") );
}
//This accessor returns a single property value
//found at index
public String getList( int index )
{
return (String)list.elementAt(index);
}
//Returns the number of elements found in the
//multi-valued property list.
public int getListSize()
{
return list.size();
}
}
Esse bean seria carregado em uma jsp :
<USEBEAN NAME="listbean" TYPE="MultiValuedBean" LIFESPAN="page">
</USEBEAN>
<LOOP PROPERTY="listbean:list" PROPERTYELEMENT="x">
<DISPLAY PROPERTY="x"><br>
</LOOP>
Porem recebo o erro:
500 Internal Server Error
java.lang.ClassCastException
at jsp.jsp.MultiValuedBean.service(MultiValuedBean.java, Compiled
Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
Sei o que eh um CastException, mas nao consigo identificar onde.
Alguem teria alguma sugestao?
Muito Obrigado,
Luis Fernando.
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
--------------------------- LISTA SOUJAVA ---------------------------
http://www.soujava.org.br - Sociedade de Usu�rios Java da Sucesu-SP
[d�vidas mais comuns: http://www.soujava.org.br/faq.htm]
[para sair da lista: http://www.soujava.org.br/forum/cadastrados.htm]
---------------------------------------------------------------------