Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Purposes of custom tags  RSS feed

 
Stanley Walker
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read through tag libraries, how to create custom tags etc. However there is one very basic step where I am still confused. I cannot understand the purpose of creating tag libraries. I know tags help to reduce scriptiing however all the examples in the books are so simplistic(so much so that it seems to be too much work to just print one line in jsp) I cannot understand in a real life project where custom tags might be required. I guess I am asking the purposes of tags and tag libraries, in projects where we do not struts. I know struts relies heavily on tlds.

Please help. I apologize if the question seems very stupid
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any time there's any duplication in HTML you can use a custom tag. Any time there's logic on the page that clutters of the page you can use a custom tag. That's all the custom tags of any framework do is reduce duplication and clutter on the source page: it's refactoring for HTML (and JSP).
 
Stanley Walker
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in case of attributes based tags how are the datatypes maintanied? for example my tag attribute expects a list, however the variable declared in the tag class is maintained as a primitive integer. what happens in such a case?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens when you try it?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!