Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

when i cast object of session appearing ClassCastException  RSS feed

 
KaiChen Yang
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First i come from asia,so reading my article requires patience.Thanks a lot.
My problem is I use MVC model JDK is 1.4.2 Tomcat is 5.0.28,when i bind class with session in servlet.
But i want to cast class is wrong.the following is my code.
JavaBean

Servlet
JSP

Exception
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order to use your bean from within a JSP, the bean needs to be in a package other than the default (no stated package).
See:
http://faq.javaranch.com/view?PackageYourBeans
And:
http://faq.javaranch.com/view?BeansNotFound
to find out exactly why.
 
Kartik Patel
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not error of Casting. its because you have not included package in to jsp.

so add your class into JSP by specifying <%@page import=""%>
 
KaiChen Yang
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm so amazing,you reply my question so quickly and accurately.
Thank you for your help
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!