| Author |
Doubt on Tag Files
|
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
What will be printed when the above tag is used as follows in a jsp page:Hello <mylib:mytag> World!</mylib:mytag> public class MyTag extends TagSupport{ public int terBody() { try { pageContext.getOut().println("In doAfterBody()"); } cdoAfatch(Exception e) { } return SKIP_BODY; }}
|
Padma priya N.G.
Be the change you want to be - Mahatma Gandhi
|
 |
Srinivasan thoyyeti
Ranch Hand
Joined: Feb 15, 2007
Posts: 557
|
|
priya, wake up. you are typing something in your dreams also.
|
Thanks & Regards,<br />T.Srinivasan,<br />SCWCD 1.4(89%),SCJP 5.0(75%)<br />"That service is the noblest which is rendered for its own sake." - Mahatma Gandhi
|
 |
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Hi, I want to know how the output can be Hello and why not Hello World? With regards, Padma priya N.G.
|
 |
Srinivasan thoyyeti
Ranch Hand
Joined: Feb 15, 2007
Posts: 557
|
|
priya, I don't know whether you are able to see your code posted correctly. But for me its greek and latin. According to your result in the second post, doStartTag() returns SKIP_BODY, then Body won't be executed. it will reach doEndTag(). see the lifeCycle carefully once again.
|
 |
khushhal yadav
Ranch Hand
Joined: Jun 20, 2007
Posts: 242
|
|
Hi Priya It will be because you are not overriding doStartTag(). And in super class i.e. TagSupport, the return type of doStartTag() is Tag.SKIP_BODY. So your body won't be executed, and doAfterBody() won't get a chance to execute. Hence, you are getting "Hello" as output not as "Hello World". I think I interpret your question to some extent. Buttttt seriously as per Srinivasan be little conscious, while you are posting. Regards, Khushhal
|
rgrds,
Khushhal
|
 |
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Hi, Sorry. It is doAfterBody tag and not doStart tag!! With regards, Padma priya N.G.
|
 |
Srinivasan thoyyeti
Ranch Hand
Joined: Feb 15, 2007
Posts: 557
|
|
khushhal yadav, Now i understood her posted after seeing your reply. The answer is same but the catch is different. .Good one.
|
 |
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Hi Everybody, I got the answer correct. Thanks. With regards, Padma priya N.G.
|
 |
Cristiano Sganzerla
Ranch Hand
Joined: Jan 14, 2006
Posts: 44
|
|
|
This is not tag file padmapriyagururajan !!
|
SCJP 1.4 - SCWCD 1.4
|
 |
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Hi, Yes. It is a question related to custom tags. Padma priya N.G.
|
 |
Raghavan Muthu
Ranch Hand
Joined: Apr 20, 2006
Posts: 3327
|
|
Originally posted by padmapriyagururajan priya: Hi, Yes. It is a question related to custom tags. Padma priya N.G.
Though it may have a little relevance, its better to give an appropriate title to the post Priya.
|
Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
|
 |
 |
|
|
subject: Doubt on Tag Files
|
|
|