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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help with indexId property of logic:iterate!
The indexId attribute of logic:iterate allows you to specify a name of a scriptlet variable to create, to hold the current iteration index. It assumes this variable is not created anywhere else. It's not intended to be used to specify the starting index of your iteration, if that's what you were trying to do. -Original Message- From: Jana Navaneethan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 29, 2003 3:04 PM 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help with indexId property of logic:iterate!
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:[EMAIL PROTECTED]] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]