I don't know any way to access indexed properties in jsp:getProperty. But I
don't think this is a problem.
First of all, there are issues with indexed properties. Those which are
arrays require that all property values be instantiated simultaneously
before any property is accessed. This is obviously inefficient, and a very
large result set can cause memory management issues. Those which have get
methods with an index argument imply, at the very least, random access,
which is not always possible (e.g., result sets in JDBC 1.0) or efficient.
There are two obvious ways to work around the "limitation" in getProperty
with a clean design. I use row,column terminology below, but the same idea
applies to any two-dimensional matrix of properties.
1. You can have your data beans return as an indexed property a "row bean"
which contains all of the "column" values. Then you can access the row bean
using simple properties.
2. Or, you can make your data beans act as simple iterators, e.g., with a
next() method, so that the simple properties returned by the bean refer to
the current row
The latter is very natural to use with the JSP tags provided and does not
require extra objects to be instantiated (or any of the drawbacks of
indexed properties). For example,
<jsp:useBean id='customers' class='com.bobfoster.Customers'>
<ol>
<% while (customers.next()) { %>
<li>
<jsp:getProperty name='customers' property='custName'>
<% } %>
</ol>
One or the other should work for most people.
Bob Foster
Symantec Internet Tools http://www.visualcafe.com/
______________________________ Reply Separator _________________________________
Subject: Using <jsp:getProperty>
Author: Volker Stiehl <[EMAIL PROTECTED]> at Internet
Date: 5/4/99 7:22 AM
A very simple question: is it possible to use <jsp:getProperty> for indexed
properties (for example in a for-loop) or is this tag only appropriate for
simple properties?
Thanks.
V. Stiehl
===========================================================================
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".
===========================================================================
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".