aspose file tools*
The moose likes JSP and the fly likes jsp:useBean  ClassCastException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp:useBean  ClassCastException" Watch "jsp:useBean  ClassCastException" New topic
Author

jsp:useBean ClassCastException

Reginald Law
Greenhorn

Joined: Jan 21, 2004
Posts: 19
I have a jsp where I use jsp:useBean. I only get the exception in the JSP after I try to update the bean in the session data (in a struts action class). Should beans only be read only, set up once never to be changed ?

I am getting this error on Jrun4.

If I initialize the bean with some initial values things work fine. It is only after I do an update to the session data that I get the error.

Now I see why sun came up with the ejb session beans. You know they work and they are reliable.

Are their undocumented scope restrictions on the jsp:useBean tag ? What application servers does this work best with.


SCJP 1.4
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
You're going to need to give some more info on this. Where exactly are you getting the casting exception, etc. Maybe post the code in question.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60080
    
  65

There are no weird restrictions. You are probably just casting the bean incorrectly somehwere. As pointed out, more info would be needed for further diagnosis.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Reginald Law
Greenhorn

Joined: Jan 21, 2004
Posts: 19
I found the problem. I was using the wrong class indeed. The session.setAttribute does work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp:useBean ClassCastException
 
Similar Threads
Writer or Streamer already obtained (??)
Question about Java Beans
need help running jsps with tomcat 4.1
URGENT Help Needed ...!!
How to update Session variable with Form Data ?