That may have been true for EA2, but the JSTL PFD (and the Beta 2 RI) no longer have the <c:declare> tag. There is only the <c:set> tag, which does not define a scripting variable.
-- Martin Cooper ----- Original Message ----- From: "Tim Moore" <[EMAIL PROTECTED]> To: "Struts Developers List" <[EMAIL PROTECTED]> Sent: Wednesday, April 24, 2002 12:22 PM 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 -- 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 > > > -- > > 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 > > > > > > > -----Original Message----- > > > From: Matt Raible [mailto:[EMAIL PROTECTED]] > > > Sent: Wednesday, April 24, 2002 1:01 AM > > > To: 'Tag Libraries Users List' > > > Cc: 'Struts Developers List' > > > Subject: c:forEach compared to logic:iterate > > > > > > > > > I'm using the logic:iterate tag in the following manner: > > > > > > <logic:iterate id="pageInfo" name="topicForm" property="pages"> > > > <html:link forward="getPage" > > > name="pageInfo" property="pageTopicMap" > > > title="<%=((PageForm)pageInfo).getName()%>"> > > > <c:out value="${pageInfo.pageSequence + 1}"/> > > > </html:link> > > > </logic:iterate> > > > > > > Which works great! However, I was hoping to migrate my > logic tags > > > to JSTL and the following doesn't work: > > > > > > <c:forEach var="pageInfo" items="${topicForm.pages}"> > > > <html:link forward="getPage" > > > name="pageInfo" property="pageTopicMap" > > > title="<%=((PageForm)pageInfo).getName()%>"> > > > <c:out value="${pageInfo.pageSequence + 1}"/> > > > </html:link> > > > </c:forEach> > > > > > > However, I get the following error when I try this: > > > > > > [ServletException in:/viewer/coursePage.jsp] Unable to compile > > > class for JSP An error occured between lines: 83 and 84 > in the jsp > > > file: /viewer/coursePage.jsp Generated servlet error: > > > D:\Tools\tomcat-4.0.1\work\localhost\onpoint\viewer\coursePage > > > $jsp.java: > > > 743: Undefined variable: pageInfo > > > _jspx_th_html_link_0.setTitle(((PageForm)pageInfo).getName()); > > > ^ 1 error ' > > > > > > > > > > > > > > > -- > > > To unsubscribe, e-mail: > > > <mailto:struts-dev-> [EMAIL PROTECTED]> > > > For > > > additional commands, > > > e-mail: <mailto:[EMAIL PROTECTED]> > > > > > > > > > > -- > > To unsubscribe, e-mail: > <mailto:struts-dev-> [EMAIL PROTECTED]> > > For > additional commands, > e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > > > > -- > To unsubscribe, e-mail: > <mailto:struts-dev-> [EMAIL PROTECTED]> > For > additional commands, > e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
