logic:iterate and field indices
Hi! I am quite new to Struts and to java, but I god hooked (former addicted perl programmer). Please keep this in mind before newbie-bashing me ;-) In my project, I have some application wide settings, launched using web.xml's load-on-startup1/load-on-startup thing. This loaded class populates some attributes with values for later use. One of the attributes for example is holding a String[]. Now, in the jsp, I have this: logic:iterate id=element name=showFacilitiesArray bean:write name=element /br / /logic:iterate This works fine so far, but because I'd like to put that into a select form, I would like to go one step further: How do I print out the index of the current field? I mean, I could do it in a scriptlet with a simple for loop, printing the i each time, but actually I would appreciate no scriptlets at all. Any hints here? Unfortunately it's not that easy to google for that kind of information :-/ Thanks in advance! André - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: logic:iterate and field indices
indexId will do http://struts.apache.org/userGuide/struts-logic.html#iterate select name=... logic:iterate id=element name=showFacilitiesArray indexId=index option value=bean:write name=index/bean:write name=element//option /logic:iterate /select You may also want to look at html:options and html:optionsCollection This would make above code a two-liner, and work with action forms. Regards Leon -Ursprüngliche Nachricht- Von: news [mailto:[EMAIL PROTECTED] Im Auftrag von Andre Bonhote Gesendet: Mittwoch, 6. April 2005 13:21 An: user@struts.apache.org Betreff: logic:iterate and field indices Hi! I am quite new to Struts and to java, but I god hooked (former addicted perl programmer). Please keep this in mind before newbie-bashing me ;-) In my project, I have some application wide settings, launched using web.xml's load-on-startup1/load-on-startup thing. This loaded class populates some attributes with values for later use. One of the attributes for example is holding a String[]. Now, in the jsp, I have this: logic:iterate id=element name=showFacilitiesArray bean:write name=element /br / /logic:iterate This works fine so far, but because I'd like to put that into a select form, I would like to go one step further: How do I print out the index of the current field? I mean, I could do it in a scriptlet with a simple for loop, printing the i each time, but actually I would appreciate no scriptlets at all. Any hints here? Unfortunately it's not that easy to google for that kind of information :-/ Thanks in advance! André - 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]
AW: logic:iterate and field indices
indexId will do http://struts.apache.org/userGuide/struts-logic.html#iterate select name=... logic:iterate id=element name=showFacilitiesArray indexId=index option value=bean:write name=index/bean:write name=element//option /logic:iterate /select You may also want to look at html:options and html:optionsCollection This would make above code a two-liner, and work with action forms. Regards Leon -Ursprüngliche Nachricht- Von: news [mailto:[EMAIL PROTECTED] Im Auftrag von Andre Bonhote Gesendet: Mittwoch, 6. April 2005 13:21 An: user@struts.apache.org Betreff: logic:iterate and field indices Hi! I am quite new to Struts and to java, but I god hooked (former addicted perl programmer). Please keep this in mind before newbie-bashing me ;-) In my project, I have some application wide settings, launched using web.xml's load-on-startup1/load-on-startup thing. This loaded class populates some attributes with values for later use. One of the attributes for example is holding a String[]. Now, in the jsp, I have this: logic:iterate id=element name=showFacilitiesArray bean:write name=element /br / /logic:iterate This works fine so far, but because I'd like to put that into a select form, I would like to go one step further: How do I print out the index of the current field? I mean, I could do it in a scriptlet with a simple for loop, printing the i each time, but actually I would appreciate no scriptlets at all. Any hints here? Unfortunately it's not that easy to google for that kind of information :-/ Thanks in advance! André - 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: AW: logic:iterate and field indices
Hi Leon Leon Rosenberg wrote: indexId will do http://struts.apache.org/userGuide/struts-logic.html#iterate Been there, but somehow didn't get what it was about ... closer now. select name=... logic:iterate id=element name=showFacilitiesArray indexId=index option value=bean:write name=index/bean:write name=element//option /logic:iterate /select Yeehaa! Thanks a lot! You may also want to look at html:options and html:optionsCollection Will do that. This would make above code a two-liner, and work with action forms. Hm ... Could you describe the latter? I am using a form bean specified in struts-config.xml and that works perfectly for other fields (like html:text). Is there something wrong with it? Cheers André - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]