First, specify the type of the objects you are iterating over by adding the
'type' attribute to your <logic:iterate> tag like this:

<logic:iterate id="category" name="CategoryList" property="categoryList"
scope="application" type="com.popware.alex.Category">

Obviously, you'll need to specify the appropriate fully qualified class
name. :-) This will cause the <logic:iterate> tag to expose the iteration
object ('category' in this case, as identified by the 'id' attribute) with
the correct type.

Then you use your custom tag like this:

<db:setCategory categoryNumber='<%= category.getCategoryNumber() %>' />

Hope this helps.

--
Martin Cooper


----- Original Message -----
From: "Alex Colic" <[EMAIL PROTECTED]>
To: "Struts" <[EMAIL PROTECTED]>
Sent: Tuesday, May 01, 2001 11:00 AM
Subject: using value of bean in my tag.


> Hi, I have a tag setup as follows:
>
> <logic:iterate id="category" name="CategoryList" property="categoryList"
> scope="application">
>   <bean:write name="category" property="categoryNumber" filter="true"/>
>   <SELECT NAME="test">
>     <db:setCategory categoryNumber="1" />
>   </SELECT>
> </logic:iterate>
> </html:form>
>
> I have an object in the servlet context that holds a vector of numbers
> corresponding to categories. I then have a custom tag that needs a number
> passed to it. The <logic:iterate tag does iterate through all the numbers
in
> the collection but how do I pass the value of the number to my own custom
> tag attribute as I have above with the number'1'? Any help is appreciated.
>
> Regards
>
> Alex
>


Reply via email to