Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom Tag

 
Sandeep Chhabra
Ranch Hand
Posts: 340
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the start tag of simple custom tag is encountered, the JSP page's servlet invokes the handler's _________ Method.

I think the answer should be doTag(). But can it something like doStartTag()

Thanks for your help.
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The question is about Simple tag. There is no doStartTag in Simple tag.

Thanks
 
Reshma Shanbhag
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To implement a Custom tag, the handler class implements javax.servlet.jsp.tagext.TagSupport (check the api for methods)

public int doStartTag() is called when the custom tag is encountered in a page.


public void doTag() is defined in javax.servlet.jsp.tagext.SimpleTagSupport class, which is extended to implement SimpleTag handler class. And this is called when simple tag is encountered in a page.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!