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 problm

 
Sree Nivas
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying HF P:513 book example. This is my code:
JSP-->
<%@ taglib prefix="myTags" uri="simpleTags" %>
<html><body>
About to invoke a tag that throws SkipPageException <br>
<myTags:simple6/>
<br>Back in the page after invoking the tag.
</body></html>

The tag handler doTag() method

package foo;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import javax.servlet.jsp.*;
import java.io.*;
import java.util.*;
public class SimpleTagTest6 extends SimpleTagSupport {

public void doTag() throws JspException,IOException {
boolean thingsDontWork=true;
getJspContext().getOut().print("Message from within doTag().<br>");
getJspContext().getOut().print("About to throw a SkipPageException");
if (thingsDontWork) {
throw new SkipPageException(); }

}
}

I have correct entries in web.xml and am using jakarta-tomcat-5.0.12. But as mentioned in the book it's not working. It's printing message after throwing the SkipPageException. My output looks like this:

About to invoke a tag that throws SkipPageException
Message from within doTag().
About to throw a SkipPageException
Back in the page after invoking the tag.

I tried with this line in jsp also:
<%@ page errorPage="errorPage.jsp" %>
But still the sameoutput.
My doubt is why it's printing message after throwing SkipPageException?
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!