Re: Question about EOs and their lifespan/uniqueness
Re: Question about EOs and their lifespan/uniqueness
- Subject: Re: Question about EOs and their lifespan/uniqueness
- From: Chuck Hill <email@hidden>
- Date: Mon, 5 Nov 2007 21:38:20 -0800
On Nov 5, 2007, at 9:29 PM, Kevin Windham wrote:
On Nov 5, 2007, at 2:26 PM, Mike Schrag wrote:
If you're not refetching it and literally holding onto the same EO
instance in your component, you're doing something wrong, because
that works. If you're setting a var on an EO and then refetching
it, that will not work -- you get a new EO. I would add a print
out in your boolean's set method to see if someone is
inadvertently setting it to false and i woudl print out
System.identityHashCode(yourEO). If it's the same instance, that
will be the same. If it's a different instance (which is probably
what is happening) it will not match.
ms
Well, I used your handy tip about the hash code and I've discovered
that they are the same objects being worked with on both pages. The
odd thing is that the only time it calls the function to set the
value of the checkbox is if the checkbox was checked to start with.
Only it sets it to false. So if I start with all false values for
my checkboxes, no set methods are called on the EO. If I start with
a true value the set method is called, but it sets to false. I find
this to be very perplexing...
Doh! I just figured out what was causing all the confusion. It was
the name binding. I had bound the checkbox names to a function that
named the boxes sequentially for a javascript I was using. It
appears that using the name binding on a checkbox breaks it. Any
ideas how to work around this name binding issue?
I don't know that it exactly "breaks" it. WO uses the name value to
determine which bit of form data to move into which Java object. You
have to be very careful hijacking it with form values. I'd guess
that your method is not generating consistent names across the
appendToResponse and takeValues phases. If you can use it, the id
binding is a much safer way to integrate with JavaScript.
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden