Since it is public static can you not just have:

----------------- B.java ----------------------
public class B {

    public String getNameOfA() {
        return A.getName();
    }
}

----------------- B.tml ----------------------
<div>${nameOfA}</div>

Or am I missing something? If it was not static you could @InjectPage A as a 
field in page B and access it that way?

Regards, Alfie.

-----Original Message-----
From: Xuan Tran Le [mailto:lexuanttk...@gmail.com] 
Sent: 08 September 2009 05:40
To: Tapestry users
Subject: Re: How to .tml template access a class's static variable

I have a stable system, so I don't want to modify so much code. In addition,
your suggestion can cause the code duplicated and very hard to maintain.

I will make clear my idea: for example, I have A class

----------------- A.java ----------------------
public class A {

    private static String name;

    public static String getName() {
        return name;
    }

    /*some method here*/

}
--------------------------------------------------

And from B.tml I want to get "name" value from getName() method. What should
I do now?


Reply via email to