cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From H.vanderLin...@MI.unimaas.nl
Subject JXTemplate introspection problem - PLEASE HELP
Date Fri, 18 Jun 2004 09:37:04 GMT
Guys,

I hope some of you can help, because I'm stuck and cannot figure out what to
do to get this solved. I've posted this on the userlist as well but got no
response, so I figured that it is probably too much related to the Cocoon
internals for a "regular" user to answer. I'm trying my luck here.

Problem:

I have two classes with more or less similar functionality. Both have a
method getFormattedValue, but in my JXTemplate only one produces a correct
output. After two days of debugging I find that the introspection finds the
method through JXTemplateGenerator.JSIntrospector.getPropertyGet in the
correct class, but fails to do so in the other class.
When I call the getFormattedValue method of the faulty class in my
flowscript I get correct output.

So

class CorrectClass () {
  Object value;
....
  public String getFormattedValue() {
     return doSomething(value);
  }
}

class FaultyClass() {
  SomeClass value;
...
  public String getFormattedValue() {
     return doSomeFormatting(value);
  }
}

jxtemplate:

<p>${obj.formattedValue}</p>


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}

 var viewdata = {obj : obj2};
 cocoon.sendPage("myTemplate", viewdata); -> <p></p>
}

Anyone?

Thanks.

Bye,

Helma van der Linden

Mime
View raw message