Re: How to .tml template access a class's static variable
Your StaticWrapper is very helpfull. Thank you. On Sun, Sep 13, 2009 at 5:16 AM, Howard Lewis Ship wrote: > public class StaticWrapper{ > public String getConstantA() return { StaticClass.A; } > > public int getConstantB() return { OtherClass.B; } > > ... etc. > } > > public class MyPage > { > private static final StaticWrapper wrapper = new StaticWrapper(); > > public StaticWrapper getWrapper() { return wrapper; } > } > > > > ... > > > > On Thu, Sep 10, 2009 at 10:40 PM, DH wrote: > > > One question is how you expect to access the variable/method in the > > template and why you prefer to show/access so many static variable in the > > template? > > > > DH > > http://www.gaonline.com.cn > > > > - Original Message ----- > > From: "Xuan Tran Le" > > To: "Tapestry users" > > Sent: Friday, September 11, 2009 1:27 PM > > Subject: Re: How to .tml template access a class's static variable > > > > > > > Because I have so many methods > > > > > > On Fri, Sep 11, 2009 at 9:27 AM, Thiago H. de Paula Figueiredo < > > > thiag...@gmail.com> wrote: > > > > > >> Em Thu, 10 Sep 2009 23:19:57 -0300, Xuan Tran Le < > > lexuanttk...@gmail.com> > > >> escreveu: > > >> > > >> Thank you. But A have so many method, so I can't do that. > > >>> > > >> > > >> Why not? > > >> > > >> > > >> -- > > >> Thiago H. de Paula Figueiredo > > >> Independent Java consultant, developer, and instructor > > >> http://www.arsmachina.com.br/thiago > > >> > > >> - > > >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > >> For additional commands, e-mail: users-h...@tapestry.apache.org > > >> > > >> > > > > > > > > > -- > Howard M. Lewis Ship > > Creator of Apache Tapestry > > The source for Tapestry training, mentoring and support. Contact me to > learn > how I can get you up and productive in Tapestry fast! > > (971) 678-5210 > http://howardlewisship.com > -- Xuan Tran Le Developer Huu Ngoc JSC.("MVN") 460 Nguyen Kiem street, Phu Nhuan district - Ho Chi Minh City - Vietnam Tel : (84-83) 9955331 Fax : (84-83) 8462596 Mobile: 093-3113122 Email: xua...@myvietnam.net Web: www.myvietnam.net IMPORTANT NOTICE: The information in this email (and any attachments) is confidential. If you are not the intended recipient, you must not use or disseminate the information.If you have received this email in error, please immediately notify me by "Reply" command and permanently delete the original and any copies or printouts thereof.Although this email and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened,it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by Huu Ngoc JSC. ("MVN") or its subsidiaries or affiliates either jointly or severally, for any loss or damage arising in any way from its use.
Re: How to .tml template access a class's static variable
public class StaticWrapper{ public String getConstantA() return { StaticClass.A; } public int getConstantB() return { OtherClass.B; } ... etc. } public class MyPage { private static final StaticWrapper wrapper = new StaticWrapper(); public StaticWrapper getWrapper() { return wrapper; } } ... On Thu, Sep 10, 2009 at 10:40 PM, DH wrote: > One question is how you expect to access the variable/method in the > template and why you prefer to show/access so many static variable in the > template? > > DH > http://www.gaonline.com.cn > > - Original Message - > From: "Xuan Tran Le" > To: "Tapestry users" > Sent: Friday, September 11, 2009 1:27 PM > Subject: Re: How to .tml template access a class's static variable > > > > Because I have so many methods > > > > On Fri, Sep 11, 2009 at 9:27 AM, Thiago H. de Paula Figueiredo < > > thiag...@gmail.com> wrote: > > > >> Em Thu, 10 Sep 2009 23:19:57 -0300, Xuan Tran Le < > lexuanttk...@gmail.com> > >> escreveu: > >> > >> Thank you. But A have so many method, so I can't do that. > >>> > >> > >> Why not? > >> > >> > >> -- > >> Thiago H. de Paula Figueiredo > >> Independent Java consultant, developer, and instructor > >> http://www.arsmachina.com.br/thiago > >> > >> - > >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > >> For additional commands, e-mail: users-h...@tapestry.apache.org > >> > >> > > > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com
Re: How to .tml template access a class's static variable
One question is how you expect to access the variable/method in the template and why you prefer to show/access so many static variable in the template? DH http://www.gaonline.com.cn - Original Message - From: "Xuan Tran Le" To: "Tapestry users" Sent: Friday, September 11, 2009 1:27 PM Subject: Re: How to .tml template access a class's static variable > Because I have so many methods > > On Fri, Sep 11, 2009 at 9:27 AM, Thiago H. de Paula Figueiredo < > thiag...@gmail.com> wrote: > >> Em Thu, 10 Sep 2009 23:19:57 -0300, Xuan Tran Le >> escreveu: >> >> Thank you. But A have so many method, so I can't do that. >>> >> >> Why not? >> >> >> -- >> Thiago H. de Paula Figueiredo >> Independent Java consultant, developer, and instructor >> http://www.arsmachina.com.br/thiago >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> >
Re: How to .tml template access a class's static variable
Because I have so many methods On Fri, Sep 11, 2009 at 9:27 AM, Thiago H. de Paula Figueiredo < thiag...@gmail.com> wrote: > Em Thu, 10 Sep 2009 23:19:57 -0300, Xuan Tran Le > escreveu: > > Thank you. But A have so many method, so I can't do that. >> > > Why not? > > > -- > Thiago H. de Paula Figueiredo > Independent Java consultant, developer, and instructor > http://www.arsmachina.com.br/thiago > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: How to .tml template access a class's static variable
Em Thu, 10 Sep 2009 23:19:57 -0300, Xuan Tran Le escreveu: Thank you. But A have so many method, so I can't do that. Why not? -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How to .tml template access a class's static variable
Thank you. But A have so many method, so I can't do that. On Tue, Sep 8, 2009 at 7:01 PM, Thiago H. de Paula Figueiredo < thiag...@gmail.com> wrote: > Em Tue, 08 Sep 2009 01:39:41 -0300, Xuan Tran Le > escreveu: > > - 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? >> > > Easy: > > public class B { >public String getName() { >return A.getName(); >} > } > > Then use ${name} in your template. > > -- > Thiago H. de Paula Figueiredo > Independent Java consultant, developer, and instructor > http://www.arsmachina.com.br/thiago > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: How to .tml template access a class's static variable
Em Tue, 08 Sep 2009 01:39:41 -0300, Xuan Tran Le escreveu: - 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? Easy: public class B { public String getName() { return A.getName(); } } Then use ${name} in your template. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: How to .tml template access a class's static variable
Since it is public static can you not just have: - B.java -- public class B { public String getNameOfA() { return A.getName(); } } - B.tml -- ${nameOfA} 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?
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? On Tue, Sep 8, 2009 at 10:38 AM, DH wrote: > I think we can't and should delegate in B class > > DH > http://www.gaonline.com.cn > > - Original Message - > From: "Xuan Tran Le" > To: "Tapestry users" > Sent: Tuesday, September 08, 2009 11:17 AM > Subject: How to .tml template access a class's static variable > > > >I want to from B.tml access a static variable/method of A class but I > don't > > know how to... Help me please > > >
Re: How to .tml template access a class's static variable
I think we can't and should delegate in B class DH http://www.gaonline.com.cn - Original Message - From: "Xuan Tran Le" To: "Tapestry users" Sent: Tuesday, September 08, 2009 11:17 AM Subject: How to .tml template access a class's static variable >I want to from B.tml access a static variable/method of A class but I don't > know how to... Help me please >