tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eduardo Pelegri--Llopart <Eduardo.Pelegrillop...@eng.sun.com>
Subject use of taglibs for developers (was Re: JSP Taglibs)
Date Mon, 12 Jun 2000 17:08:26 GMT
Expanding a bit on Tasso's reply...

For the scenario described: the same individual is playing the dual role
of developer and page & site author, I think the best argument for the
use of tag libraries is better composability within a page.  A custom
action tag hnalder is a server-side JavaBeans with an additional
run-time protool that provides very easy ways to:

 - set values to bean propoerties (via an attribute)
 - evaluate actions before and after a body of "stuff" (via doStartTag()
and doEndTag())
 - define scripting variables
 - manipulate a body.

Custom actions can interact with each other in a way that increases
their applicability.

For example, when I wrote a collection of conformance tests for the
specification, I wrote a few custom actions and then used then in a
number of different combinations.  It was very productive to do it this
way, in addition to the points above, it lead to a quick production
cycle.

Since a custom tag requires some additional effort, you have to do some
cost/benefit analysis.  Simple custom actions are really easy to write:
essentially just need to take a JavaBean, sprinkle a doStartTag() +
implements and add a TLD. In this case, I think the major cost is
understanding the concept of a tag.  Actions that can manipulate their
content are more complex.

i would not say "use custom actions for everything", but they do have a
value for developers.

Hope this helps,

	- eduard/o

Taso Lyristis wrote:
> 
> "A. Scott White" wrote:
> >
> > Why should I define taglibs rather than simply writing standard java classes
> > and calling their methods from JSP script elements? Is there some hidden
> > benefit to the complication of taglibs that I'm not quite understanding.
> >
> > I suppose, if you wanted to create a simpler grammar for dynamic content for
> > a non-programmer content developer of some kind, taglibs would provide this
> > mechanism. If, however, I'm a Java programmer and I'm responsible for
> > content, it seems that taglibs are another level of unnecessary abstraction.
> >
> > Please correct me if I'm missing some important distinction.
> 
> What you say pretty much makes sense.
> 
> Taglibs are good way to let people who are HTML savvy, but not Java
> savvy, make use of backend Java logic without having to write Java
> code.  Taglibs can also be used in IDE's to let users "drop in" some
> functionality onto a page.
> 
> If you, a Java programmer, are the only one touching the JSP code, there
> is nothing wrong with using straight Java.  But if you find yourself
> doing a lot of things over and over (a typical case: looping over some
> collection and displaying the data in, say, a table), writing few
> taglibs might come in handy.
> 
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org

Mime
View raw message