You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Graham Lounder <lo...@caris.com> on 2002/04/25 14:35:41 UTC

logic:iterate question

Hello all,

I've got a question about the logic:iterate tag.  I'm trying to reference a bean which returns a String[] but I only want one of the values in the array.  The indexID is working but it isn't getting passed to the bean:write tag corretly.  It throws a 

java.lang.IllegalArgumentException: Invalid indexed property 'attributeNames[]'

If I passed the bean a hardcoded index value, it works.  I can also print out the value of the index.  I think it may be some kind of timing issue in struts and maybe it can't be done.  Any Ideas?



<logic:iterate id='element' 
              name='attribute' 
              scope='page' type='java.lang.String' indexId='index'>

    <bean:write name='MAP_STATE_KEY' 
                  property='mapController.dataConnection.attributeNames[<%= index %>]' 
                     scope='session'/>

</logic:iterate>     


Thanks,
Graham


Re: logic:iterate question

Posted by Nicolas De Loof <ni...@cgey.com>.
<logic:iterate id='element'
              name='attribute'
              scope='page' type='java.lang.String' indexId='index'>

    <bean:write name='MAP_STATE_KEY'
property='mapController.dataConnection.attributeNames[<%= index %>]'
                     scope='session'/>


Correct your bean:write tag so attribute property becomes full scriplet
syntax coded :

property='<%= \"mapController.dataConnection.attributeNames[\"+ index +
\"]\"%>'

Nico


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>