Can we access members 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???

Ted Husted

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 + "]" %>'/>

In the Struts nightly build, indexed properties are supported directly, so that scriptlets like this are not needed

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact