• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question

 
Tony romer
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q: When the start tag of a simple custom tag is encountered, the JSP page's servlet invokes the handler's _____________ method.

In whizlabs simulator, practice exam#3, question:19

I answered this as doTag, but answer says doStartTag.

Do I understand something wrong here?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do I understand something wrong here?

Nope. Simple tags, differing from Classic Tags, do not use doStartTag and doEndTag. This question should be about Classic Tags.

The lifecycle of a Simple Tag is (from the API):
1. A new tag handler instance is created each time by the container by calling the provided zero-args constructor. Unlike classic tag handlers, simple tag handlers are never cached and reused by the JSP container.
2. The setJspContext() and setParent() methods are called by the container. The setParent() method is only called if the element is nested within another tag invocation.
3. The setters for each attribute defined for this tag are called by the container.
4. If a body exists, the setJspBody() method is called by the container to set the body of this tag, as a JspFragment. If the action element is empty in the page, this method is not called at all.
5. The doTag() method is called by the container. All tag logic, iteration, body evaluations, etc. occur in this method.
6. The doTag() method returns and all variables are synchronized.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic