You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Nelson, Laird" <La...@FMR.COM> on 2003/05/07 16:34:18 UTC
RE: [Unverified Sender] RE: logic:iterate help needed: "id" not a
vailable/broken/buggy?
> -----Original Message-----
> From: Nelson, Laird [mailto:Laird.Nelson@fmr.com]
>
> > -----Original Message-----
> > From: Kris Schneider [mailto:kris@dotech.com]
> >
> > Since you're using 1.0.2:
> >
> > <bean:message key='<%=
> > String.valueOf(pageContext.getAttribute("p")) %>'
> > bundle="bundleKey"/>
>
> Thank you! That did the trick. Is this a bug? A feature?
Also, sometimes it appears that page context variables are available to
scriptlets as is, and sometimes they appear not to be. What are the
governing rules behind this? I'll dig into the JSP specification in the
meantime.
As an illustration, this works:
<bean:define id="blat" name="someExistingBean" type="fiz.boo.baz"/>
<%
final int squishiness = blat.getSquishiness();
%>
...but, as I've been illustrating in my other messages, the page context
bean defined by the "id" attribute of <logic:iterate> is not available for
use "as is" by a runtime expression within <bean:message>'s "key" attribute.
>From looking at the code, DefineTag.java does a simple
pageContext.setAttribute(). The IterateTag.java also does a simple
pageContext.setAttribute(). How come I can refer to one "as is" in a
scriptlet, and can't refer to it in a runtime expression?
Laird
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Unverified Sender] RE: logic:iterate help needed: "id" not a vailable/broken/buggy?
Posted by Kris Schneider <kr...@dotech.com>.
I believe that's determined by whether a tag has a TagExtraInfo class declared
in its TLD. The TagExtraInfo.getVariableInfo method provides the details on
which scripting variable get created.
Quoting "Nelson, Laird" <La...@FMR.COM>:
> > -----Original Message-----
> > From: Nelson, Laird [mailto:Laird.Nelson@fmr.com]
> >
> > > -----Original Message-----
> > > From: Kris Schneider [mailto:kris@dotech.com]
> > >
> > > Since you're using 1.0.2:
> > >
> > > <bean:message key='<%=
> > > String.valueOf(pageContext.getAttribute("p")) %>'
> > > bundle="bundleKey"/>
> >
> > Thank you! That did the trick. Is this a bug? A feature?
>
> Also, sometimes it appears that page context variables are available to
> scriptlets as is, and sometimes they appear not to be. What are the
> governing rules behind this? I'll dig into the JSP specification in the
> meantime.
>
> As an illustration, this works:
> <bean:define id="blat" name="someExistingBean" type="fiz.boo.baz"/>
> <%
> final int squishiness = blat.getSquishiness();
> %>
> ...but, as I've been illustrating in my other messages, the page context
> bean defined by the "id" attribute of <logic:iterate> is not available for
> use "as is" by a runtime expression within <bean:message>'s "key"
> attribute.
>
> >From looking at the code, DefineTag.java does a simple
> pageContext.setAttribute(). The IterateTag.java also does a simple
> pageContext.setAttribute(). How come I can refer to one "as is" in a
> scriptlet, and can't refer to it in a runtime expression?
>
> Laird
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
--
Kris Schneider <ma...@dotech.com>
D.O.Tech <http://www.dotech.com/>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Unverified Sender] RE: logic:iterate help needed: "id" not a
vailable/broken/buggy?
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Wed, 7 May 2003, Nelson, Laird wrote:
> Date: Wed, 7 May 2003 10:34:18 -0400
> From: "Nelson, Laird" <La...@FMR.COM>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: 'Struts Users Mailing List' <st...@jakarta.apache.org>
> Subject: RE: [Unverified Sender] RE: logic:iterate help needed: "id" not
> a vailable/broken/buggy?
>
> > -----Original Message-----
> > From: Nelson, Laird [mailto:Laird.Nelson@fmr.com]
> >
> > > -----Original Message-----
> > > From: Kris Schneider [mailto:kris@dotech.com]
> > >
> > > Since you're using 1.0.2:
> > >
> > > <bean:message key='<%=
> > > String.valueOf(pageContext.getAttribute("p")) %>'
> > > bundle="bundleKey"/>
> >
> > Thank you! That did the trick. Is this a bug? A feature?
>
> Also, sometimes it appears that page context variables are available to
> scriptlets as is, and sometimes they appear not to be. What are the
> governing rules behind this? I'll dig into the JSP specification in the
> meantime.
>
The governing rule is whether or not the tag declares that it creates a
scripting variable or not. In any version of JSP, the <tei-class> element
in the TLD for a tag is an indicator that it does create one or more
scripting variables. In JSP 1.2 or later, you can also use the <variable>
element to explicitly identify the variable to be created.
Most Struts tags do not create scripting variables, because you are
encouraged to use tags instead of scriptlets for dynamic processing.
> As an illustration, this works:
> <bean:define id="blat" name="someExistingBean" type="fiz.boo.baz"/>
> <%
> final int squishiness = blat.getSquishiness();
> %>
> ...but, as I've been illustrating in my other messages, the page context
> bean defined by the "id" attribute of <logic:iterate> is not available for
> use "as is" by a runtime expression within <bean:message>'s "key" attribute.
>
That's correct -- it's only available as a page context attribute.
> >From looking at the code, DefineTag.java does a simple
> pageContext.setAttribute(). The IterateTag.java also does a simple
> pageContext.setAttribute(). How come I can refer to one "as is" in a
> scriptlet, and can't refer to it in a runtime expression?
>
> Laird
>
Craig
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org