On Wed, 24 Apr 2002, Tim Moore wrote:
> Date: Wed, 24 Apr 2002 15:22:17 -0400
> From: Tim Moore <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: RE: forEach compared to logic:iterate
>
> > -----Original Message-----
> > From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, April 24, 2002 2:34 PM
> > To: Struts Developers List
> > Subject: RE: forEach compared to logic:iterate
> >
> >
> >
> >
> > On Wed, 24 Apr 2002, Tim Moore wrote:
> >
> > > Date: Wed, 24 Apr 2002 14:22:04 -0400
> > > From: Tim Moore <[EMAIL PROTECTED]>
> > > Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> > > To: Struts Developers List <[EMAIL PROTECTED]>
> > > Subject: RE: forEach compared to logic:iterate
> > >
> > > <c:forEach var="pageInfo" items="${topicForm.pages}">
> > > <c:declare id="pageInfo" type="<package>.PageForm"/>
> > > <html:link forward="getPage" name="pageInfo"
> > property="pageTopicMap"
> > > title="<%=pageInfo.getName()%>">
> > > <c:out value="${pageInfo.pageSequence + 1}"/>
> > > </html:link>
> > > </c:forEach>
> > >
> > > The important part is the c:declare, which defines the scripting
> > > variable (var attributes in other tags don't). Also the
> > type attribute
> > > lets you remove the cast from the scriptlet.
> > >
> > > You could also use bean:define, but if you're migrating away from
> > > Struts tags, you'll probably want to do it this way.
> >
> > A more fundamental issue is that JSTL tags like <c:define> do
> > not expose a scripting variable at all -- they only create an
> > attribute in the appropriate scope. Therefore, the scriptlet
> > in the code below will never work unless you use
> > <bean:define> instead (which creates both an attribute and a
> > scrpting variable.
>
> Well I thought that c:declare was made specificially for the purpose of
> defining a scripting variable from a page attribute for use in legacy
> tags. That's my understanding of the documentation:
>
> http://jakarta.apache.org/taglibs/doc/jsptl-doc/Overview.html
>
We're actually both out of date.
The doc you cited above was from JSTL EA2, which corresponded to the
initial public draft of JSTL 1.0. In the current document (Proposed Final
Draft), and in the beta-2 release, <c:define> was removed. My remarks
about not creating the scripting variable are accurate for <c:set>, which
can be used to calculate an expression value and set a corresponding
attribute in some scope.
> --
> Tim Moore / Blackboard Inc. / Software Engineer
> 1899 L Street, NW / 5th Floor / Washington, DC 20036
> Phone 202-463-4860 ext. 258 / Fax 202-463-4863
>
Craig
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>