struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "mech" <m...@rz.fh-augsburg.de>
Subject RE: Help with indexId property of logic:iterate!
Date Thu, 30 Jan 2003 00:09:12 GMT
What you are doing can't work. Simply because "indexId" is not for
writting something in. Instead a scripting variable of the name you
specify in "indexId" will be created containing the current index of the
iterate loop.

Suppose you have <logic:iterate ...indexId="testid">
Then inside of the iterate tag you could say <bean:write name="testid"/>

You get an error because the iterate tag itself defines that scripting
variable, but you defined it before aswell yourself. So in the java
class of this jsp you would have something like: "Integer startNum = new
Integer();" twice, which must conflict. One time you did it with
<bean:define>, the second time it is done by the iterate tag to deliver
you the current index in that variable.

I guess in your case you should use the "offset" (and maybe "length")
attribute of the logic:iterate tag.
"indexId" gives you the current index, you can't set yourself! 
"offset" let's you set the starting index and "length" tells the tag how
many results to present.

Michael

> -----Original Message-----
> From: Jana Navaneethan [mailto:jana.navaneethan@labs.gte.com] 
> Sent: Donnerstag, 30. Januar 2003 00:04
> To: Struts Users Mailing List
> Subject: Help with indexId property of logic:iterate!
> 
> 
> Hi,
>      I want to utilize indexId of <logic:iterate> to display 
> list of values from the collection, I want to set this 
> indexId as a property from my action form bean like this, 
> <bean:define id="startIndex" name="categorySearchResultForm" 
> type="java.lang.Integer" property="startNum"/> In my form 
> bean getStartNum() returns an Integer. Then I try to use this 
> bean in my iterate tag like below, <logic:iterate id="normal" 
> name="categorySearchResultForm" property="normalCategories"  
> indexId="startIndex"> I am getting compilation error stating 
> "startIndex" is already defined! How to get around this 
> problem? Any help would be greatly appreciated.
> 
> Thanks a lot,
> Jana.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message