That's not the case as I've created this example on the fly in this message. In fact when running a similar function like doesNotWork and I print obj.toString() in both the flowscript and the template I get the same reference, so the actual object is properly retrieved.
Of course, your observation that FaultyClass is faulty is probably correct, but I have no idea how to figure out what's wrong, since it correctly compiles and all methods behave as expected. Bye, Helma > -----Original Message----- > From: Niklas Eklund [mailto:[EMAIL PROTECTED] > Sent: Friday, 18 June 2004 12:20 > To: [EMAIL PROTECTED] > Subject: Re: JXTemplate introspection problem - PLEASE HELP > > > [EMAIL PROTECTED] wrote: > > <snip /> > > flowscript: > > > > function works() { > > someValue = "correctTest"; > > > > CorrectClass obj = new Packages.mypackage.CorrectClass(); > > obj.setValue(someValue); > > print("correct class: " + obj.getFormattedValue()) -> correctTest > > > > var viewdata = {obj : obj}; > > cocoon.sendPage("myTemplate", viewdata); -> <p>correctTest</p> } > > > > function doesNotWork() { > > someValue = "correctTest"; > > > > FaultyClass obj2 = new Packages.mypackage.FaultyClass(); > > obj2.setValue(someValue); print("faulty class: " + > > obj.getFormattedValue()) -> correctTest} > ^^^ > This might not be the problem, but your FaultyClass could be > faulty if > you used cut'n'paste from your actual code. The line above uses > obj.getFormattedValue() and not obj2.getFormattedValue() which could > give the illusion that your FaultyClass is correct even if it > isn't, if > obj is global. > > Regards, > Niklas > > > var viewdata = {obj : obj2}; > > cocoon.sendPage("myTemplate", viewdata); -> <p></p> > > } > > > > Anyone? > > > > Thanks. > > > > Bye, > > > > Helma van der Linden >
