useBean problem
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Monday, January 21, 2002 06:54 AM

Hi, I have a problem with a bean. I put it on a session in a servet with the putValue method: session.putValue("res", (Resul)res); Where Resul is the name of the bean class. The problem appears when I try to recover that bean from a session in a jsp page with a useBean tag: The bean is found but it fails on the cast of the bean (when a bean is found in the scope with the given id, the java code generated with the jsp tries to make a cast of the object found to the class put on the tag). Well it fails on that, but I don't know why!! The class is the same and there mustn't be an error!! Please help! I have the same problem during 6 days an   More>>

Hi,


I have a problem with a bean. I put it on a session in a servet with the putValue method:


session.putValue("res", (Resul)res);


Where Resul is the name of the bean class. The problem appears when I try to recover that bean from a session in a jsp page with a useBean tag:




The bean is found but it fails on the cast of the bean (when a bean is found in the scope with the given id, the java code generated with the jsp tries to make a cast of the object found to the class put on the tag). Well it fails on that, but I don't know why!! The class is the same and there mustn't be an error!!


Please help! I have the same problem during 6 days and I don't know what to do!!


Sergi

   <<Less

Re: useBean problem

Posted By:   Niko_Schmuck  
Posted On:   Monday, January 21, 2002 08:22 AM

I would it debug this in the following fashion, to avoid casting errors in the first instance:

session.putValue("res", res);

and then retrieve the object in your jsp:


right after that you can print out what class this object is an instance of:

<%= res.getClass().getName() %>

Hope this gives you an entry point in finding the root of your problem.

Niko.

About | Sitemap | Contact