• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Custom Taglib Question

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This post may contain a couple of questions, but since they are related I didn't want to start several threads.
I realize that when you write custom tags it would make sense to make them reusable. However, if someone is relativly quick at creating custom tags, how important is reusability when the design goal is to clean up the JSP pages and Servlet for a task that will be performed in several places on the web app in several JSP pages?
Also, is it a bad idea to perform actual Database access inside a custom tag? Or should the data be handed to the tag in after retrieving it from the database?
In my web app I am working on, I have some tasks that I think I would like to pull out of the JSP's and Servlets and put them in some custom tags. And as of right now, they are pretty specific tasks to this web app and I don't see myself immedialty reusing them. In fact, since I will be using this to learn how to write custom tasks, I don't see myself trying too terribly hard to make them reusable at this point in time. I just thought I would mention that as it may affect the response to my questions.
Thanks
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gregg,
For myself, I use both tags that I have written that are useful across a wide range of web apps, and tags that are appropriate only to a single app.
bear
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you got 2 clashing principles here:
On the left you have the idea that taglibs should be as generic as possible, on the right the idea that you should not make things generic if there is no need for them.
On the whole I'd say keep the tags simple, you can always abstract things away at a later date.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic