commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject Re: [jelly] Using BeanTagLibrary for "action" tags
Date Tue, 25 Feb 2003 22:54:05 GMT
From: "Thomas Nichols" <nx10mail@yahoo.co.uk>
> Hello,
>
> Is it possible to use BeanTagLibrary and have the top-level tags - i.e.
> those registered with registerBean() - actually DO something? The plumbing
> used in
> jelly-tags/bean/src/test/org/apache/commons/jelly/tags/bean/
> works a treat, and requires a minimal amount of glue (most of which can be
> abstracted into super classes - great.)

Agreed.

> However, though this is useful for "data assembly" I want the top-level
tag
> to perform an action - which I'm currently doing using a standard
> TagLibrary impl and TagSupport-derived tag classes. With the existing
> ("imperative") code, doTag() is invoked for the top-level, registered,
tag,
> so I can take appropriate actions. How do I do this using the plumbing of
> BeanTagLibrary?
>
> I'm trying to get the following -
> <sync>
>    <input1><file name="reggae.xml"/></input1>
>    <input2><url value="http://www.pinkflag.com/wire/punk.xml"/></input2>
> </sync>
>
> The inputX, url and file classes are just data wrappers, BeanTagLibrary
> handles this very elegantly if I have
>      registerBean (sync, Sync.class) in  MyTagLibrary ctor. I want to
> invoke the "sync" processing on the collected data once the input1 and
> input2 elements have been parsed. Is this possible?
>
> The refactoring has made for a cleaner architecture IMHO - worth the pain,
> for me at least.

Good idea Thomas.

I've just patched the Bean tag library so that you can register a Method (or
method name) which can be passed into the BeanTagLibrary.registerBean()
method or used by the <beandef/> tag to specify a zero argument 'doit'
method. So this method could be run() for Runnable objects or execute() for
Ant like tasks etc.

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

Mime
View raw message