Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:useBean ClassCastException

 
Reginald Law
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Reginald Law
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the problem. I was using the wrong class indeed. The session.setAttribute does work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic