• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SkipPageException one more problem

 
Sree Nivas
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried HF Page 515 also. I'm getting output similar to previous one. I'm wondering really what's happening here.

Kathy (or any expert)... Could u pl clarify this.

Code is here: P:515 HF book
PageA JSP that includes PageB
<html><body>
This is page (A) that includes another page (B). <br>
Doing the include now: <b>
<jsp:include page="badTagInclude.jsp"/>
<br>Back in page A after the include...
</body></html>

PageB(the included file) JSP that invokes the bad tag
<%@taglib prefix="myTags" uri="simpleTags"%>
This is page B that invokes the tag that throws SkipPageException.
Invoking the tag now: <br>
<myTags:simple6/>
<br>Still in page B after the tag invocation...

The tag handler doTag() method
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(); }

}
simple.tld file entry:

<tag>
<description>Testing SkiPageException</description>
<name>simple6</name>
<tag-class>foo.SimpleTagTest6</tag-class>
<body-content>empty</body-content>
</tag>

But the output was:

This is page (A) that includes another page (B).
Doing the include now: This is page B that invokes the tag that throws SkipPageException. Invoking the tag now:
Message from within doTag().
About to throw a SkipPageException
Still in page B after the tag invocation...
Back in page A after the include...

Still in page B after the tag invocation...
As mentioned in the book, Page B also printed just as we have not expected.

What's wrong here?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic