You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ken in Nashua <kc...@live.com> on 2012/09/28 20:28:41 UTC

is there a way to refer to a Class type in a tml ?

Folks,

I am referring to the old T4 manner in which we would refer to a class type using 

@Integer.class

within a template

can this be done in T5 ?

Thanks and have great weekend
Ken
 		 	   		  

Re: is there a way to refer to a Class type in a tml ?

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Sat, 29 Sep 2012 00:16:57 -0300, Ken in Nashua <kc...@live.com>  
wrote:

> Thanks Thiago... that worked for my one class.
>
> But...
>
> @java.lang.Math@min(collection.size,itemsPerPage)
>
> the above statement... I am sure you know what it is T4

Don't be so sure. The first usable versions of Tapestry 5 were released 4  
years ago. It's been quite rare to get a T4 question, so I guess most  
people here have never used Tapestry 5.

>
> What I am looking for is a T5 solution to reference these classes and  
> operate them right inside the template.
>
> Is there a solution in T5 to do this?

Ken, please, how many times do we need to say that the philosophy in  
Tapestry about logic in templates has changed? Regardless of Tapestry, the  
best practices have been of putting all logic in Java classes for at least  
ten years?

If you really want to put logic in your templates, something we strongly  
say don't do that, you can use ChenilleKit's OGNL property binding or, as  
Muhammad Gelbana suggested, create your own binding.

-- 
Thiago H. de Paula Figueiredo

Re: is there a way to refer to a Class type in a tml ?

Posted by Bryan Lewis <jb...@gmail.com>.
This might help:

http://chenillekit.codehaus.org/chenillekit-tapestry/ognlbinding.html

On Friday, September 28, 2012, Ken in Nashua wrote:

>
> Thanks Thiago... that worked for my one class.
>
> But...
>
> @java.lang.Math@min(collection.size,itemsPerPage)
>
> the above statement... I am sure you know what it is T4
>
> What I am looking for is a T5 solution to reference these classes and
> operate them right inside the template.
>
> Is there a solution in T5 to do this?
>
> I feel like I need to design another
>
> public Class mathClass() {
>     return Math.class;
> }
>
> and on and on... for any other classes I would like to use.
>
> kcolassi@live.com <javascript:;>
>
>
>
>
> > To: users@tapestry.apache.org <javascript:;>; kcolassi@live.com<javascript:;>
> > Subject: Re: is there a way to refer to a Class type in a tml ?
> > Date: Fri, 28 Sep 2012 15:51:25 -0300
> > From: thiagohp@gmail.com <javascript:;>
> >
> > On Fri, 28 Sep 2012 15:28:41 -0300, Ken in Nashua <kcolassi@live.com<javascript:;>
> >
> > wrote:
> >
> > > Folks,
> >
> > Hi!
> >
> > > I am referring to the old T4 manner in which we would refer to a class
> > > type using
> > >
> > > @Integer.class
> > >
> > > within a template
> > >
> > > can this be done in T5 ?
> >
> > The Tapestry 5 philosophy is to do this kind of stuff in Java, never in
> > the template, probably putting it in a getter:
> >
> > Class getIntegerClass() {
> >       return Integer.class;
> > }
> >
> > In your template:
> >
> > ${integerClass}
> >
> > --
> > Thiago H. de Paula Figueiredo
>

RE: is there a way to refer to a Class type in a tml ?

Posted by Ken in Nashua <kc...@live.com>.
Thanks Thiago... that worked for my one class.

But...

@java.lang.Math@min(collection.size,itemsPerPage)

the above statement... I am sure you know what it is T4

What I am looking for is a T5 solution to reference these classes and operate them right inside the template.

Is there a solution in T5 to do this?

I feel like I need to design another 

public Class mathClass() {
    return Math.class;
}

and on and on... for any other classes I would like to use.

kcolassi@live.com
 



> To: users@tapestry.apache.org; kcolassi@live.com
> Subject: Re: is there a way to refer to a Class type in a tml ?
> Date: Fri, 28 Sep 2012 15:51:25 -0300
> From: thiagohp@gmail.com
> 
> On Fri, 28 Sep 2012 15:28:41 -0300, Ken in Nashua <kc...@live.com>  
> wrote:
> 
> > Folks,
> 
> Hi!
> 
> > I am referring to the old T4 manner in which we would refer to a class  
> > type using
> >
> > @Integer.class
> >
> > within a template
> >
> > can this be done in T5 ?
> 
> The Tapestry 5 philosophy is to do this kind of stuff in Java, never in  
> the template, probably putting it in a getter:
> 
> Class getIntegerClass() {
> 	return Integer.class;
> }
> 
> In your template:
> 
> ${integerClass}
> 
> -- 
> Thiago H. de Paula Figueiredo
 		 	   		  

Re: is there a way to refer to a Class type in a tml ?

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Fri, 28 Sep 2012 15:28:41 -0300, Ken in Nashua <kc...@live.com>  
wrote:

> Folks,

Hi!

> I am referring to the old T4 manner in which we would refer to a class  
> type using
>
> @Integer.class
>
> within a template
>
> can this be done in T5 ?

The Tapestry 5 philosophy is to do this kind of stuff in Java, never in  
the template, probably putting it in a getter:

Class getIntegerClass() {
	return Integer.class;
}

In your template:

${integerClass}

-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org