You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Steve Bang <SB...@alphablox.com> on 2002/03/11 18:01:20 UTC
2nd try: Using to change scope
Can anyone help me on this?
Thanks,
Steve
> -----Original Message-----
> From: Steve Bang [mailto:SBang@alphablox.com]
> Sent: Friday, March 08, 2002 11:03 AM
> To: 'Tag Libraries Users List'
> Subject: Using <set> to change scope
>
>
> We have a custom tag library that treats all of our tags with
> a session scope (by design). Is it possible to use JSTL's
> <c:set> tag to change the scope on one of the attributes on
> our tags? Users are requesting the ability to dynamically
> change an attribute value on our tags when a page is refreshed,
> but so far this is not possible within the tags themselves --
> they are only interpreted the first time a page loads. If
> so, do we have to modify our tag library to support this?
>
> Steve
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: 2nd try: Using to change scope
Posted by Shawn Bayern <ba...@essentially.net>.
Ah, I meant to try to answer this, but it slipped through...
I wasn't sure exactly what you meant by "change the scope on one of the
attributes on our tags." You can use <c:set> to override an existing
attribute, and thus to change the scope of a scoped variable:
<c:set var="foo" scope="session" value="${page.foo}"/>
but I'm not sure if that's what you mean.
You can't make the 'scope' attribute dynamic, which might be another thing
you mean. That is, you can't say scope="${myscope}". This restriction is
designed primarily to aid tool support and translation-time error
checking. If you need to decide on the fly what scope to use, you'll need
to use a <c:if> or <c:choose> block. We didn't consider this case very
common, so the somewhat circuitous solution didn't seem to be a major
issue. (Hmm, that's the first I've used the word "circuitous" to actually
refer to circuit-like logic. I wonder if that counts as a pun or not...)
--
Shawn Bayern
Author, "JSP Standard Tag Library" http://www.jstlbook.com
(coming this spring from Manning Publications)
On Mon, 11 Mar 2002, Steve Bang wrote:
> Can anyone help me on this?
>
> Thanks,
> Steve
>
> > -----Original Message-----
> > From: Steve Bang [mailto:SBang@alphablox.com]
> > Sent: Friday, March 08, 2002 11:03 AM
> > To: 'Tag Libraries Users List'
> > Subject: Using <set> to change scope
> >
> >
> > We have a custom tag library that treats all of our tags with
> > a session scope (by design). Is it possible to use JSTL's
> > <c:set> tag to change the scope on one of the attributes on
> > our tags? Users are requesting the ability to dynamically
> > change an attribute value on our tags when a page is refreshed,
> > but so far this is not possible within the tags themselves --
> > they are only interpreted the first time a page loads. If
> > so, do we have to modify our tag library to support this?
> >
> > Steve
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>