| 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
Rancher
Joined: Apr 07, 2010
Posts: 1043
|
|
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
Rancher
Joined: Apr 07, 2010
Posts: 1043
|
|
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
Rancher
Joined: Apr 07, 2010
Posts: 1043
|
|
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
|
 |
 |
|
|
subject: Question on doEndTag()
|
|
|