This "looks" like it will work, but there is no c:declare tag in JSTL.
There is a c:set, but it has no type attribute.

Thanks,

Matt

> -----Original Message-----
> From: Tim Moore [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, April 24, 2002 12:22 PM
> To: Struts Developers List
> 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.
> -- 
> 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
> 
> 
> > -----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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to