I tend to agree with Tim here, but only in certain circumstances.  If you
place very specific HTML code in your tag library then that tag library has
become very restricted in its use - basically it can only be used in the
original context for which it was designed, otherwise the HTML will probably
not match up properly.  That makes re-using your taglibs pretty difficult,
at least without re-writing the HTML within each time.  

On the other hand, if you don't care about cross-project reusability, then
embedding HTML into a tag isn't such a bad idea since you only care about it
for the current project and current needs. Personally, I think it's ideal to
generate the minimalist amount of generic HTML as possible in a tag and then
wrap it in HTML on the JSP when you use the tag.  Again, that's only if
you're going for maximum reusability.  Right now, I've got some HTML
embedded in our tags, but it's very generic HTML that can be used again and
again without much actual change to the Java code itself. :)

-Chris


-----Original Message-----
From: Tim Colson [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 30, 2001 9:20 PM
To: [EMAIL PROTECTED]
Subject: RE: some comparision between JSP/struts and velocity


> Niall Pemberton suggested
> ...if the Struts tags dont do what you want then write your
> own. Then you dont have to use scriptlets, you have a re-useable bit of
> functionality, the web designers are happy and you dont have to use
> Velocity.
While a custom tag is an option; this bit of functionality would have
required embedding  javascript code and html inside the custom tag lib. To
me, putting view specific code like inside a tag library is also a slippery
slope in the quest to keep thing separated.

Cheers,
Timothy

Reply via email to