Missed that,
Thanks
Patrick Casey wrote:
I don't think it's a bug; I think it's the fact that your "count"
value is defined as static :). So both your beans are addressing the same
integer when they count.
--- Pat
-----Original Message-----
From: Derick Fernando [mailto:[EMAIL PROTECTED]
Sent: Monday, November 21, 2005 5:08 PM
To: [email protected]
Subject: Issue with beans of the same class
Hello,
I have two beans declared on a page:
Page:
<bean name="one" class="sandbox.test.Counter"/>
<bean name="two" class="sandbox.test.Counter"/>
Java:
package sandbox.test;
public class Counter
{
private static int count = 0;
public Counter(){ count = 0; }
public int getNext(){ return count++; }
}
Html:
<p jwcid="@For" source="ognl:list" element="literal:p">
Counter 1: <span jwcid="@Insert" value="ognl:beans.one.next"/>
Counter 2: <span jwcid="@Insert" value="ognl:beans.two.next"/>
</p>
Output:
Counter 1: 0 Counter 2: 0
Counter 1: 1 Counter 2: 2
Counter 1: 3 Counter 2: 4
Counter 1: 5 Counter 2: 6
The problem as you can see occurs after the first iteration. I think
this may be a bug, just wanted to make sure before I open an issue in
JIRA.
Thanks
.........................................
Derick Fernando
Lead Architect
[EMAIL PROTECTED]
(323) 314-9593
http://www.thelabllc.com
Content is for intended recipient only.
Copyright 2001-2005, The Lab, LLC
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
__________ NOD32 1.1275 (20051103) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
.........................................
Derick Fernando
Lead Architect
[EMAIL PROTECTED]
(323) 314-9593
http://www.thelabllc.com
Content is for intended recipient only.
Copyright 2001-2005, The Lab, LLC
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]