commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Keese" <bi...@tech.beacon-it.co.jp>
Subject Re: [Jelly] Modularization: To Return A Non XMLOutput/StringObject
Date Tue, 10 Jun 2003 00:23:44 GMT
Ah, I see.  The child function returns an output value w/a statement like
this:
  <j:set var="myOutputVar1" scope="parent" value="myOutputValue"/>

Cool.

Bill

--------------------------
<j:jelly xmlns:j="jelly:core" xmlns:define="jelly:define"
xmlns:myTagLib="myTagLib">

  <define:taglib uri="myTagLib">
    <define:tag name="innerFunc">
      <j:set var="myOutputVar1" scope="parent" value="myOutputValue"/>
    </define:tag>

    <define:tag name="outerFunc">
      <myTagLib:innerFunc/>
      outerFunc called innerFunc and the return value was ${myOutputVar1}
    </define:tag>
  </define:taglib>

  <myTagLib:outerFunc/>

</j:jelly>

--------------------------

$ ../jelly outputVarTest.jelly

      outerFunc called innerFunc and the return value was myOutputValue

----- Original Message ----- 
From: "Robert McIntosh" <REMCINTOSH@kcc.usda.gov>
To: <commons-user@jakarta.apache.org>
Sent: Monday, June 09, 2003 9:41 PM
Subject: Re: [Jelly] Modularization: To Return A Non XMLOutput/StringObject


> I personally don't remember a thread about have return values for tags,
> but most tags do put things into the JellyContext with their 'var'
> attribute and there is also the j:set tag for setting a variable which
> we use as a 'return type'.
>
> Even with that however, we use Jelly as an all purpose scripting
> language without the XMLOutput. In most cases we even modularize it and
> use the import tag to having one script invoke another script. We then
> use the JellyContext to get out all of the values that we are looking
> for. Yes it will contain other things you don't need, but in our case
> anyway, we don't particularly care about that.
>
> Robert
>
> >>> paul@activemath.org 06/06/03 03:53PM >>>
> Harold Russell wrote:
> > Hi,
> >
> > I've been experimenting with Jelly to determine if it
> > is suitable to use as a general purpose prototyping
> > language. First thing I was trying to do was to write
> > code that are "modularized." By "modularized" I meant
> > something like a function which has its own local
> > variable scope.
> >
> > My first try was using a define:taglib and define:tag
> > tags to create my own custom tag. I can "call" this
> > "module" by using the tag and attributes as input
> > parameters. This is the closest thing that resembles a
> > reusable "module"/"function" as the code inside the
> > tag has its own variable scope.
> >
> > The only problem is that when my custom tags are
> > evaluated, it can only return XMLOutput/String and not
> > any other object.
> >
> > Does anyone have any advice on writing "modularized"
> > code in Jelly?
>
> The way it is done into such things as jelly-swing is that the tag
> climbs the hierarchy to the first possible ancestor tag that can
> receive
> a result and "adds" it there.
> (namely, this is how a component is added to a container).
>
> There has been a long thread however about having return values for
> tags.
>
> Paul
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>


Mime
View raw message