• Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom Tags

 
Sophie Angela
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case of custom tags,while calling the getParent() method can we use super.getParent().?

If yes how it is different from this.getParent();
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getParent() will be available if you are extending your tag through TagSupport or BodyTagSupport classes whereas if you are trying to implement Tag/Iteration/BodyTag then you'll have to override getParent() method in your tag handler.

In case of TagSupport/BodyTagSupport, same java rule will apply i.e. you can call super.getParent() because these classes provide their implementation for this method. Whereas you can override the method in your tag handler and thus can call through this.getParent().

Hope it helps
 
Sophie Angela
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
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!