You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Jim Richards <gr...@cyber4.org> on 2001/06/07 06:55:59 UTC

colection use in and

Why does <logic:iterate/> use a collection as 

	A runtime expression that evaluates to a collection to be iterated over.

and <html:options>

	Name of the JSP bean (in some scope) which is itself a Collection of other
	beans, each of which has properties named by the "property" and "labelProperty"
	attributes that are used to retrieve the value and label for each option,
	respectively. [RT Expr] 

effective, if I use <logic:iterate> I can do (something like) this

	<logic:iterate id="template" collection="<%= (SortedMap) application.getAttribute(\"template\")).getEntries() %>">

	</logic:iterate>

which is really handy, but for <html:options> I have to do

        <% pageContext.setAttribute("catalog", myCatalogCollection); %>
        <html:select property="catalog_id">

            <html:options collection="catalog" property="value.id" labelProperty="value.description"/>

        </html:select>

I'd rather have in the middle

            <html:options collection="<%= catalog %>" property="value.id" labelProperty="value.description"/>

or similar, like I can do with iterate.


--
Kumera - a new Open Source Content Management System
for small to medium web sites written in Perl and using XML
http://www.cyber4.org/kumera/index.html

Re: colection use in and

Posted by Jim Richards <gr...@cyber4.org>.
Or put better from the index of the javadoc

	setCollection(Object) - Method in class org.apache.struts.taglib.EnumerateTag
		Set the collection over which we will be enumerating. 

	setCollection(Object) - Method in class org.apache.struts.taglib.IterateTag 
		Set the collection over which we will be iterating. 

	setCollection(Object) - Method in class org.apache.struts.taglib.bean.SizeTag 

	setCollection(Object) - Method in class org.apache.struts.taglib.logic.IterateTag 

	setCollection(String) - Method in class org.apache.struts.taglib.html.OptionsTag 
       
Spot the odd one out.

At 02:55 PM 7/06/01 +1000, you wrote:
>
>Why does <logic:iterate/> use a collection as 
>
>	A runtime expression that evaluates to a collection to be iterated over.
>
>and <html:options>
>
>	Name of the JSP bean (in some scope) which is itself a Collection of other
>	beans, each of which has properties named by the "property" and "labelProperty"
>	attributes that are used to retrieve the value and label for each option,
>	respectively. [RT Expr] 
>
>effective, if I use <logic:iterate> I can do (something like) this
>
>	<logic:iterate id="template" collection="<%= (SortedMap) application.getAttribute(\"template\")).getEntries() %>">
>
>	</logic:iterate>
>
>which is really handy, but for <html:options> I have to do
>
>        <% pageContext.setAttribute("catalog", myCatalogCollection); %>
>        <html:select property="catalog_id">
>
>            <html:options collection="catalog" property="value.id" labelProperty="value.description"/>
>
>        </html:select>
>
>I'd rather have in the middle
>
>            <html:options collection="<%= catalog %>" property="value.id" labelProperty="value.description"/>
>
>or similar, like I can do with iterate.
>
>
>--
>Kumera - a new Open Source Content Management System
>for small to medium web sites written in Perl and using XML
>http://www.cyber4.org/kumera/index.html
> 
--
Kumera - a new Open Source Content Management System
for small to medium web sites written in Perl and using XML
http://www.cyber4.org/kumera/index.html