This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes JavaBeat question, SKIP_BODY Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "JavaBeat question, SKIP_BODY" Watch "JavaBeat question, SKIP_BODY" New topic

JavaBeat question, SKIP_BODY

Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707

Could anybody please focus on this, why the output is Hello?


Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585

The output is Hello because you did not override the doStartTag() method, which its default return value is SKIP_BODY, so, the body will not be be evaluated.

Best of luck ...

Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
Because MyTag doesn't override the doStartTag() method.

The default behavior of the doStartTag is that there is no body evaluated.

You should add the following code for getting output

Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707
Thanks Vassili & Remko!

I got the that.

You rock dude.

Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
It is always a good idea to set up the code in question and run it to see what is happening and why. You can even step thru the code in debug mode.

I did this when preparing for the exam and I learned so much that the exam was a breeze...
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707
I agree with you Michael!

It is sorta covered in the JavaRanch Style Guide.
subject: JavaBeat question, SKIP_BODY
Similar Threads
Doubt on Tag Files
Mock Exam Question.
jdiscuss mock exam question
doubts in CustomTags
Taghandler doubt