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

SkipPageException

 
Tridib Samanta
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we throw skip SkipPageException from classic tag?
 
Anupama Ponnapalli
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The purpose of the skip page exception is achieved in classic tags by returning SKIP_PAGE from the doEndTag.

Does that answer your question?
 
Tridib Samanta
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Anupama.
I understand your answer. But my question is, can we use SkipPageException in Classic tags as an alternative to SKIP_PAGE?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm only pasting the API, but it may answer your question :
This exception should not be thrown manually in a JSP page or tag file - the behavior is undefined. The exception is intended to be thrown inside SimpleTag handlers and in JSP fragments.

By the way, from where exactly do you want to throw it ? This is a checked exception that you'll have to declare.
 
Tridib Samanta
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception is intended to be thrown inside SimpleTag handlers and in JSP fragments.


Thanks Satou! I got the answer.

By the way, from where exactly do you want to throw it ? This is a checked exception that you'll have to declare.


I was thinking to throw it from doEndTag(). Although SkipPageException is a checked exception you need not declare it in throws clause, b/c doEndTag() method throws JspException which is the base class of SkipPageException.
I developed a classic tag which is using SkipPageException to skip the page evaluation. It worked perfectly in tomcat 6. But looking at the API documentation it seems that using SkipPageException in classic tag is not intended.

Thanks guys for your reply.
 
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!