>> In JSP 1.0/1.1, neither setProperty nor getProperty have any provision
>> for indexed properties.
Hans Bergsten wrote:
>I don't agree. In the JSP 1.0 spec, indexed properties are mentioned
>explicitly for setProperty. The description could be clearer, but I know the
>intention was to support multi-value parameter values like the ones from a
>collection of checkboxes since I was involved in the discussion about this
>part of the specification. The JSP 1.1 spec apparently needs to clarify
>this.
You're right, what I said was wrong. JSP 1.0 explicitly supports indexed
properties in setProperty, but only to the extent that you can set using an
array value. A property with an array setter works just like a non-indexed
property. (For a property with only an indexed setter, the implementation
could produce a loop that will index the array and feed the property value to
the bean one element at a time. But the spec doesn't say it will.)
Similarly, (though the spec doesn't say it will) getProperty should have no
trouble getting an array value from a property with an array getter.
What I should have said the first time is that setProperty and getProperty
don't have any provision for _indexing_ properties. They don't allow you to
specify an index and thus do not support setting or getting individual
elements of indexed properties. This is the feature people usually look for,
e.g., to display rows of results in a scriptlet loop.
A workaround is to have your beans do the indexing. In fact, an example of
this appears in the JSP spec:
<jsp:setProperty name="results" property="row" value="<%= i+1 %>" />
Once having set the "row" property in this bean, hopefully the column values
can be obtained from a simple, non-indexed getProperty, e.g.,
<jsp:getProperty name="results" property="customerName" />
Or, you could forget about getProperty and just call indexed getters directly
in a JSP expression.
Hopefully, this reply is more accurate (and more helpful) than my last
attempt. :)
Bob Foster
Symantec Internet Tools http://www.visualcafe.com/
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".