On Sun, 8 Sep 2002, Jay wrote:
> Do this:
>
> Pass the variable name as a value to the tag, just like the actual value.
>
> <zp:authenticate var="<%=user%>" value="<%userName%>"/>
Such a tag, without being associated with a TagExtraInfo class or using
the <variable> TLD element, cannot modify scripting variables. You could
certainly write a tag that uses one of its attribute's values to modify a
particular, runtime-configurable scoped variable, but this won't have any
effect on the corresponding scripting variable by itself.
Note that JSTL specifically refuses to allow dynamic attribute values in
'var'; the goal there was to facilitate tool support by making it easier
to know what values were present at translation time. It's a model I
recommend adopting elsewhere, and when you use scripting variables, you of
course don't get the choice, for the container *absolutely* needs the
name of the scripting variable at translation time.
If you need to modify values with dynamic names, you can use the
<c:set target="..." property="..." value="..." />
syntax in conjunction with a Map. For instance:
<jsp:useBean id="map" class="java.lang.HashMap" />
<c:set target="${map}" property="${myDynamicValue}" value="..." />
Hope that helps,
--
Shawn Bayern
"JSTL in Action" http://www.jstlbook.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com