You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by John Hunt <te...@yahoo.com> on 2001/02/12 06:14:18 UTC

rte as subscript

can we access memebers of an array like
<form:select property="array[i]"> in a for loop... It
works if I use constants but not expressions.. 
property="array[0]" is fine but not array[i] or
array[<%=i>] for the property attribute of
form:select. Any clues???

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Re: rte as subscript

Posted by John Hunt <te...@yahoo.com>.
Craig
I tried using it, but I think when it is converted
into html it goes out like <select name="array[0]">
but when we posted your code tries to look for 
array%5b0%5d ( [ and ] ) being encoded. Is this what
is expected????

--- "Craig R. McClanahan"
<Cr...@eng.sun.com> wrote:
> John Hunt wrote:
> 
> > can we access memebers of an array like
> > <form:select property="array[i]"> in a for loop...
> It
> > works if I use constants but not expressions..
> > property="array[0]" is fine but not array[i] or
> > array[<%=i>] for the property attribute of
> > form:select. Any clues???
> >
> >
> 
> The property accessor syntax in Struts 1.0 supports
> only constants as
> array subscripts.
> 
> You might consider using some sort of runtime
> expression instead, to
> dynamically calculate the property to be retrieved. 
> Assume that "i" is
> an integer variable, and you are inside a loop:
> 
>     <form:select property='<%= "array[" + i + "]"
> %>'/>
> 
> Craig
> 
> 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Re: rte as subscript

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
John Hunt wrote:

> can we access memebers of an array like
> <form:select property="array[i]"> in a for loop... It
> works if I use constants but not expressions..
> property="array[0]" is fine but not array[i] or
> array[<%=i>] for the property attribute of
> form:select. Any clues???
>
>

The property accessor syntax in Struts 1.0 supports only constants as
array subscripts.

You might consider using some sort of runtime expression instead, to
dynamically calculate the property to be retrieved.  Assume that "i" is
an integer variable, and you are inside a loop:

    <form:select property='<%= "array[" + i + "]" %>'/>

Craig