Hi all, i got a class cast exception trying to
use an instance of an object throught 2 jsp pages or so.
dumb example:
fct.jsp:
-----------------------
<%!
public class
Website
{
private int num;
private
String nom;
public
Website()
{
this.num=100;
this.nom="example";
}
}
%>
ess.jsp:
------------------------
<%@ include file="/fct.jsp" %>
<%@
page import="java.util.*"%>
<%
Website ess=new
Website();
Vector v=new
Vector();
v.add(ess);
session.setAttribute("essai",v);
System.out.println(ess.getClass().getName());
%>
ess2.jsp
---------------------------
<%@ include file="/fct.jsp" %>
<%@
page import="java.util.*"%>
<%
Vector
v=(Vector)session.getAttribute("essai");
Website
ess=(Website)v.get(0);
%>
=> i first load ess.jsp and got the following
in log:
__jspPage2_ess_jsp$Website
=>When i load ess2.jsp i got a class cast
exception and when i check the class name :
__jspPage2_ess_jsp$Website
How i can bypass this trouble and why the class
name is not Website and thats all ?
Thx in advance for ur help.
Chris