File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Question on doEndTag() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Question on doEndTag() " Watch "Question on doEndTag() " New topic
Author

Question on doEndTag()

Parth Twari
Ranch Hand

Joined: Jan 20, 2010
Posts: 163
source :wizlab

If an exception is encountered during the evaluation of body of tag the doEndTag() method of tag will not be called?
true/false


Parth Tiwari
| Pursuing Bachelor of Engineering | OSUM Club Leader | SCJP 6 | SCWCD 5 |...
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1665
    
  25

Hi Marcus,

What do you think is the answer? It is nice to submit your ideas with the question.....

Just write a small web-app and try it, you can have a look at this previous thread.

Regards,
Frits
Parth Twari
Ranch Hand

Joined: Jan 20, 2010
Posts: 163
hey frits,

i tried it at last

and got the result as true

the doEndTag() will not be evaluated.

When any of doStartTag and doAfterBody or body of tag itself throws exception then the processing stops right there only and the tag and page is not evaluated further.

Thanks

Parth

If someone wants the code , tell me
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1665
    
  25

Hi Parth,

Correct! Now to make things a bit more complicated: let me ask you another question:

What if the tag (where the exeption is thrown) is in an included jsp ->
a) the processing of the included jsp and the including jsp stops
b) the processing of the included jsp stops and the including jsp continues

what do you think?

Regards,
Frits
Parth Twari
Ranch Hand

Joined: Jan 20, 2010
Posts: 163
Well..

From what I have read :

if the tag in an included jsp throws SkipPageException

then the further processing of the tag and the included jsp stops

and the including jsp continues with its processing.

I thought similar will be the case with other exceptions as well. The tag and the included page will be stopped but the including page will continue with its processing.

But its not the case when i tested it -

When the included jsp's tag's body threw a exception then further processing of the tag and both the pages was stopped right there and exception was thrown.

So I feel the answer is (a)
right?
Does SkipPageException get special treatment?
Rajeev Rnair
Ranch Hand

Joined: Mar 22, 2010
Posts: 308

Have you tried <jsp:include /> or the <@ include %> directive?


SCJP6, SCWCD5, OCP-JBCD5, OCE-JWSD6 OCE-JPAD6 , OCM-JEA5 1,OCM-JEA5 2,3 - Brainbench certifications: J2EE, Java2, Java2-NonGUI, JSP, SQL2000 Admin, SQL2000 Programming , Brainbench certified Java Programmer, Computer Programmer, Web Developer, Database Administrator
Parth Twari
Ranch Hand

Joined: Jan 20, 2010
Posts: 163
Have you tried <jsp:include /> or the <@ include %> directive?


I used <jsp:include />
if we use <@ include %> directive the it will be no difference the new jsp and the tag will become part of our jsp and that we have tested allready

showing us that when our jsp's tag throws an exception then processing will be terminated there itself.
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1665
    
  25

So I feel the answer is (a)
right?
Does SkipPageException get special treatment?

Yes, the SkipPageException is an exception on the JspException's: it was meant for SimpleTags (thrown from doTag()) to have a simular behaviour possible like the Classis Custom Tag doEndTag() return code SKIP_PAGE.

Regards,
Frits
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Question on doEndTag()