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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "SimpleTags" Watch "SimpleTags" New topic


Steven Colley
Ranch Hand

Joined: Feb 18, 2005
Posts: 290
Help me here...

The invocation protocol used by SimpleTag is simplified from the one used for Classic tag handlers. Which one of the following statements is NOT true of the SimpleTag interface?

1- The SimpleTag interface extends directly from JspTag and does not extend Tag.

2- SimpleTag provides no support for accessing body content.

3- SimpleTag does not have any inherent JSP/Servlet knowledge embedded
within it.

4- The javax.servlet.jsp.tagext.SimpleTagSupport class provides a default implementation for all methods in SimpleTag.

5- SimpleTag only has one lifecycle method, doTag()

SCJP | SCWCD | SCBCD | SCWSD 5 | SCEA (I) 1.4 | SCEA 5 | IBM SOA 669
shweta bulbule
Ranch Hand

Joined: Mar 24, 2006
Posts: 30
option 2.

Thanks,<br />Shweta
Madhu Sudhana
Ranch Hand

Joined: Apr 16, 2006
Posts: 127
what are the life cycle methods in the SimpleTag

"And the trouble is, if you don't risk anything, you risk even more." -- Erica Jong.
Charles Lyons
Ranch Hand

Joined: Mar 27, 2003
Posts: 836
Statement 2 is definitely false, as a SimpleTag does have access to the JspFragment representing its body content - so it certainly can evaluate it and even buffer and edit the data.

The point of a SimpleTag (as well as being easier to write) is that it is not bound to the Servlet model - which makes JSPs and tags portable over to non-Java platforms as well. So I'm tempted to say 3 could be correct (that is to say, a false statement), but I'm not quite sure what they mean by "JSP/Servlet knowledge embedded within it".

So 2 is the really correct answer, but 3 is not as clear as it could be.

Oh, and the life cycle methods are things like doStartTag(), doInitBody() for classic tags - for a simple tag, the only obvious one is doTag(). However, methods like setParent() and setJspContext() are life-cycle methods simply because they are always invoked as part of the life of a SimpleTag. Therefore, in fact, I also disagree with statement 5 and believe that to be false. The life cycle methods for SimpleTag (taken directly from the API documentation) are:

[attribute setters]

which is in fact all setter methods in SimpleTag (getParent() is the only other method)! If you don't believe me, look at the API class documentation under the section "Lifecycle":
[ April 16, 2006: Message edited by: Charles Lyons ]

Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )
Steven Colley
Ranch Hand

Joined: Feb 18, 2005
Posts: 290
Hi Charles, you were dead clear! Tks so much !!
I appreciate all your help
I agree. Here's the link:
subject: SimpleTags
It's not a secret anymore!