aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt on Tag Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Doubt on Tag Files" Watch "Doubt on Tag Files" New topic
Author

Doubt on Tag Files

Padma priya Gururajan
Ranch Hand

Joined: Oct 05, 2006
Posts: 430
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, T.Srinivasan
SCWCD 1.4(89%), SCJP 5.0(75%)
Padma priya Gururajan
Ranch Hand

Joined: Oct 05, 2006
Posts: 430
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: 430
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: 430
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: 430
Hi,
Yes. It is a question related to custom tags.
Padma priya N.G.
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt on Tag Files
 
Similar Threads
doubts in CustomTags
Mock Exam Question.
jdiscuss mock exam question
JavaBeat question, SKIP_BODY
passing custom objects for Tag