It should work.  I can only think of two reasons why it fails:
- Maybe JRun 2.3's implementation gets confused because you use the same
name for your beans as for the name of their class.

I know the sun reference implementation of 0.92 would create code like:
bank.BankCustomer
BankCustomer=(bank.BankCustomer)request.getAttribute("BankCustomer");
if (BankCustomer==null) {
// create a new bean, do the SETONCREATE stuff, etc.
}

While this code is valid, it's not so difficult to come up with an example
that wouldn't compile.  Perhaps sun should give some naming guidelines for
the beans too, like using at least one lowercase character at the start like
for normal variables.

- Since <% BankCustomer.getName() %> DOES work, the above doesn't apply, and
the only thing that's left is the space in the property parameter: <DISPLAY
PROPERTY=" BankCustomer:Name">.
JRun's parser probably searches for a bean with the name " BankCustomer"
instead of "BankCustomer"...

Luc


> -----Original Message-----
> From: Wine Vaughn [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 14, 1999 7:47 PM
> To: [EMAIL PROTECTED]
> Subject: Cannot access other bean properties in LOOP
>
>
> PROBLEM:  I cannot access other bean properties in a LOOP.
> In other words,
> I can only access LOOP properties.
>
> EXAMPLE:  Say that I have a JSP aware bean called
> BankCustomer, and the bean
> has two properties: Name and an array type property called
> BankAccount.  (My
> bean, of course, has set/get methods for Name.  In addition,
> there is a
> getBankAcountSize method that returns the size of the bank
> account array,
> and there is a getBankAccount method that takes an integer as
> an index into
> the array.)
>
> The important part of my JSP page looks like this:
>
> <USEBEAN NAME="BankCustomer" TYPE="bank.BankCustomer "
> LIFESPAN="page">
>   <SETONCREATE BEANPROPERTY="Name"  VALUE="John Smith">
> </USEBEAN>
>
> <LOOP PROPERTY="BankCustomer:BankAccount" PROPERTYELEMENT="Account">
>   Customer Name = <DISPLAY PROPERTY=" BankCustomer:Name"><BR>
>   Bank Account = <DISPLAY PROPERTY="Account"><BR>
>   <BR>
> </LOOP>
>
> I want to produce output that lists all John's bank accounts
> (which are
> retrieved from a database, let's say), but I what to repeat
> the customer
> name each loop:
>
> John Smith
> CHECKING1
>
> John Smith
> SAVINGS1
>
> John Smith
> SAVINGS2
>
>
> However, this does not work!  It is choking on the Customer
> Name line in the
> loop:  I'm using JRun 2.3 on NT 4.0 with IIS.  Is this a
> problem with JRun
> or a problem with the JSPs, in general?
>
>
> The simple work around is to use <% %>:
>
> <LOOP PROPERTY="BankCustomer:BankAccount" PROPERTYELEMENT="Account">
>   Customer Name = <% BankCustomer.getName() %><BR>
>   Bank Account = <DISPLAY PROPERTY="Account"><BR>
>   <BR>
> </LOOP>
>
>
> What's so bad about this?  Well, I'm trying to put as much
> functionality as
> possible in the bean, so that I can avoid Java in the JSP.
> Why?  So that I
> can capitalize on the LOOP and DISPLAY tags and make the JSP
> appear like
> HTML (to simplify the presentation elements of JSP).
>
>
> GRIPE:  If Sun is going to add LOOP and DISPLAY tags, then
> they should be
> powerful enough to do something simple like this (what I've
> shown above).
> If these new constructs are not powerful and flexible enough,
> then I think
> they should be pulled completely.  I don't like mixing these
> tags with <%
> %>.
>
> Your thoughts are welcome.
>
> Vaughn Wine
>
> ==============================================================
> =============
> 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".

Reply via email to