Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How this works >>>> PageContext pageContext = (PageContext) getJspContext();

 
Tuna Töre
Ranch Hand
Posts: 220
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How this works ?

PageContext pageContext = (PageContext) getJspContext();

PageContext is the sublass of JspContext... Isn't this give ClassCastException...
I am confused ?

java.lang.Object
javax.servlet.jsp.JspContext
javax.servlet.jsp.PageContext


 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, you really need to go back to SCJP. Seriously.
 
Tuna Töre
Ranch Hand
Posts: 220
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry I thougt at amoment an equation like that which gives me class cast exception but you are right. Thanks...



Exception in thread "main" java.lang.ClassCastException: A
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!