commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: [jelly] Using BeanTagLibrary for "action" tags
Date Tue, 25 Feb 2003 22:54:05 GMT
From: "Thomas Nichols" <>
> 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.)


> However, though this is useful for "data assembly" I want the top-level
> 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,
> 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=""/></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.


Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

View raw message