commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Sell <christian.s...@netcologne.de>
Subject Re: [jelly] taglib implementation questions
Date Mon, 20 Jan 2003 17:40:06 GMT
I did not want to derive my taglib from BeanTagLibrary, because:

1) I dont like to be closely coupled to an external library, which only 
supplies optional features that are not at the core of my lib.

2) the above can also be rephrased as a OO design aspect. My library "is 
not a BeanTagLibrary". It has a completely different purpose. For 
example, by inheriting from BeanTagLibrary, it would suddenly support 
the "beandef" tag, which is completely alien to its function.

after all, inheritance is only available once, and therefore should be 
used with caution..

James Strachan wrote:
> From: "Christian Sell" <christian.sell@netcologne.de>
> 
>>Hi,
>>
>>is there a way to do this:
>>
>><mytag class="myClass">
>>   <someTag someAtt="dada>
>>     <anotherNestedElement att="dada"/>
>>   </someTag>
>></mytag>
>>
>>where <mytag> comes from a library which is not derived from
>>BeanTagLibrary or any other Library, and the other tags are not defined
>>in any library.
>>
>>The result should be that from the nested tags an object hierarchy is
>>created, and the root object supplied to the mytag object through the
>>setSomeTag() method.
> 
> 
> Right now if you created your own library, deriving from BeanTagLibrary and
> registered "mytag" as a possible root tag, it'd all just work. However you
> did say...
> 
> 
>>where <mytag> comes from a library which is not derived from
>>BeanTagLibrary or any other Library
> 
> 
> why do you have this restriction? Is it namespaces that you don't want to
> expose to the end user? You can always register that the empty namespace
> binds to your tag library and it'd just work.
> 
> e.g.
> 
> public class MyTagLibrary extends BeanTagLibrary {
>     public MyTagLibrary() {
>         registerBean( "mytag", MyDefaultBean.class );
>     }
> }
> ...
> 
> JellyContext context = new JellyContext();
> context.registerTagLibrary( "", new MyTagLibrary() );
> context.runScript( "my.jelly" );
> 
> then the script that you supplied would just work.
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <mailto:commons-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-user-help@jakarta.apache.org>
> 
> 



Mime
View raw message