jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <bay...@generationjava.com>
Subject Re: Taglib variables
Date Fri, 14 Dec 2001 18:15:55 GMT
Sorry. I'm mixing the words variable and attribute too much. Let me try
for another example.

<jc:set var="name" value="Unknown"/>
<str:capitalize var="newname" use="name"/>

or

<company:dbWrapper column="PQR_NAME" id="$session:id" var="name"/>
<str:capitalize var="newname" use="name"/>

Then, the taglib, rather than using the body of the tag or a 'string'
attribute, would do:

    Object target = pageContext.getAttribute( getUse() );

Is that making any more sense?

Bay

On Fri, 14 Dec 2001, Shawn Bayern wrote:

> I'm not sure I'm following, but it sounds like you're looking to treat the
> input as potentially a collection of Strings...?  If that's the case, then
> by analogy with <c:forEach> ('items'), what about calling the attribute
> 'strings'?
>
> Shawn
>
> On Fri, 14 Dec 2001 bayard@generationjava.com wrote:
>
> > 'value' would be wrong in this case though Shawn. Or at least for how I
> > was planning to pass information in.
> >
> > Using your examples:
> >
> > <str:capitalize var="BIG" value="$little"/>
> >
> > <str:capitalize var="BIG" use="little"/>    (I removed the $)
> >
> > ie) the 'use' attribute I was discussing would say use the variable
> > 'little' in the pageContext and not, here's a string to act upon.
> >
> > While my string example could happily pass strings to act upon in, I am
> > assuming there are other times when a Collection or array or just some
> > unknown object would want to be passed in and dealt with accordingly.
> >
> > Any ideas?
> >
> > Bay
> >
> > On Fri, 14 Dec 2001, Shawn Bayern wrote:
> >
> > > Bay,
> > >
> > > Good question!  My personal sense is that the JSTL EG didn't feel a need
> > > to standardize on attributes representing 'source,' given that the uses of
> > > sources vary so widely -- and also given that many tags take multiple
> > > inputs.  (By contrast, only a few tags output multiple variables.)
> > >
> > > I'd say 'value' is probably the most generic one we use, when the input
> > > variable's purpose is general and there's only a single one.  (For
> > > instance, <c:expr> uses 'value'.)  But, for instance, JSTL specifically
> > > uses 'select' instead of 'value' for XPath expressions -- in order to help
> > > set them apart and make them more noticeable.
> > >
> > > I think it's much more important to be consistent when the *use* is the
> > > same than when it's not.  For instance, in JSTL, source XML documents are
> > > always accessed by 'source' (unless they're XSLT stylesheets).
> > >
> > > To answer your specific question, I'd personally encourage 'value', to
> > > match <c:expr>.  For instance,
> > >
> > >   <str:capitalize var="BIG" value="$little"/>
> > >
> > > looks better to me personally than
> > >
> > >   <str:capitalize var="BIG" use="$little"/>
> > >
> > > ("Use" seems to make more sense to the tag developer than to the user.)
> > >
> > > For the 'string' tags, though, 'string' also wouldn't be a bad choice:
> > >
> > >   <str:capitalize var="BIG" string="$little"/>
> > >
> > > Shawn
> > >
> > > On Fri, 14 Dec 2001 bayard@generationjava.com wrote:
> > >
> > > > Hopefully a simple question.
> > > >
> > > > The JSTL (and others I'm sure) uses the 'var' attriubute to mean:
> > > >
> > > > Save the result into this attribute.
> > > >
> > > > Is there a (vaguely) standard attribute name to use if you want the
> > > > contents of the attribute to be used as input to the tag?
> > > >
> > > > So:
> > > >
> > > > <str:capitalise var="fred" use="bob"/>
> > > >
> > > > will take the contents of the variable bob, capitalise it and store it
in
> > > > the variable fred??
> > > >
> > > > If there is no standard, any preference on one? 'use'? 'usevar'?
> > > >
> > > > Bay
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>


Mime
View raw message