You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by di...@multitask.com.au on 2003/03/12 17:16:32 UTC
[jelly] [define]
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" />
--
dIon Gillard, Multitask Consulting
Blog: http://www.freeroller.net/page/dion/Weblog
Work: http://www.multitask.com.au
Re: [jelly] [define]
Posted by di...@multitask.com.au.
Works a treat, thanks James!
--
dIon Gillard, Multitask Consulting
Blog: http://www.freeroller.net/page/dion/Weblog
Work: http://www.multitask.com.au
"James Strachan" <ja...@yahoo.co.uk> wrote on 13/03/2003 04:49:29
AM:
> From: <di...@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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
Re: [jelly] [define]
Posted by James Strachan <ja...@yahoo.co.uk>.
From: <di...@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