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] [define]
Date Wed, 12 Mar 2003 17:49:29 GMT
 From: <dion@multitask.com.au>
> Is there some way for a defined tag to check/get the content of it's body?
>
> let's say I have a tag defined:
>
>     <define:tag name="exec">
>        <exec dir="." executable="${maven.ssh.executable}">
>          <arg line="${maven.repo.central} -l ${maven.username}
> '${command}'"/>
>        </exec>
>     </define:tag>
>
> Which I'd like to get ${command} from the tag body the user provides, or
> the attribute, in that order, e.g. support:
>
> <tag:exec>
> text/other jelly stuff here
> </tag:exec>
>
> or
>
> <tag:exec command="asdasd" />


To invoke the tags body from inside a dynamic tag use <define:invokeBody/>

If you wish to capture the output of the body as a variable and then pass it
into some other tag/bean/method then try something like this (warning - this
is untested, am just typing it straight into an email client which doesn't
yet have Jelly support :)

    <define:tag name="exec">
        <!-- allow either command attribute or use body of exec tag -->
        <j:if test="${empty(command)}">
            <j:set var="command"><define:invokeBody/></j:set>
        </j:if>

       <exec dir="." executable="${maven.ssh.executable}">
         <arg line="${maven.repo.central} -l ${maven.username}
'${command}'"/>
       </exec>
    </define:tag>

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