You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sommeralex <al...@gmail.com> on 2013/01/27 11:54:52 UTC

parameter in tml page?

is it possible to put parameters in a tml page?

eg:
Java:

String getDescriptionForTag(String tag){
   return descriptionService.getDescriptionForTag(tag);
}

TML:

<div>
User 1

${getDescription(user1)}
</div>


<div>
User 2

${getDescription(user2)}
</div>



--
View this message in context: http://tapestry.1045711.n5.nabble.com/parameter-in-tml-page-tp5719561.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: parameter in tml page?

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Okay, I getcha. You can use String literals if that helps...

e.g. ${getObject('bob')}

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


Re: parameter in tml page?

Posted by sommeralex <al...@gmail.com>.
as i sayed: it just use this feature for testing - in production mode,
i will use a dynamic implementation. but for testing, i *need* to play with
the GIU (and therefore, tml)

thx!!!!!




2013/1/29 Thiago H de Paula Figueiredo [via Tapestry] <
ml-node+s1045711n5719648h30@n5.nabble.com>

> On Tue, 29 Jan 2013 09:19:19 -0200, sommeralex
> <[hidden email] <http://user/SendEmail.jtp?type=node&node=5719648&i=0>>
> wrote:
>
> > Hi Thiago!
>
> Hi!
>
> > The point is, i want to change my tml pages as quick and easy as
> > possible.
>
> And you end up with a mess of a template . . . With Tapestry's live class
>
> reloading, you don't need to write ugly, logic-full templates to have
> productivity.
>
> > I have a method, which is giving me, what i  need. getObject(String
> key).
> >
> > If TML would support parameters for functions,
> >
> > i could easily write
> >
> > ${getObject(x)}
> >
> > ${getObject(y)}
>
> Tapestry already supports that. You just need to use ${getObject('y')}
> (note the quotes) when passing literal strings.
>
> --
> Thiago H. de Paula Figueiredo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5719648&i=1>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5719648&i=2>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://tapestry.1045711.n5.nabble.com/parameter-in-tml-page-tp5719561p5719648.html
>  To unsubscribe from parameter in tml page?, click here<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5719561&code=YWxleGFuZGVyLnNvbW1lckBnbWFpbC5jb218NTcxOTU2MXwxMDUzMzQxMzM4>
> .
> NAML<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://tapestry.1045711.n5.nabble.com/parameter-in-tml-page-tp5719561p5719649.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: parameter in tml page?

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 29 Jan 2013 09:19:19 -0200, sommeralex  
<al...@gmail.com> wrote:

> Hi Thiago!

Hi!

> The point is, i want to change my tml pages as quick and easy as  
> possible.

And you end up with a mess of a template . . . With Tapestry's live class  
reloading, you don't need to write ugly, logic-full templates to have  
productivity.

> I have a method, which is giving me, what i  need. getObject(String key).
>
> If TML would support parameters for functions,
>
> i could easily write
>
> ${getObject(x)}
>
> ${getObject(y)}

Tapestry already supports that. You just need to use ${getObject('y')}  
(note the quotes) when passing literal strings.

-- 
Thiago H. de Paula Figueiredo

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


Re: parameter in tml page?

Posted by sommeralex <al...@gmail.com>.
Hi Thiago!

The point is, i want to change my tml pages as quick and easy as possible. 

I have a method, which is giving me, what i  need. getObject(String key).

If TML would support parameters for functions, 

i could easily write 

${getObject(x)}

${getObject(y)}

and so on.

Otherwise, i have to write methods in my java page class:

getObjectX
getObjectY

and refere to them in my TML as

${getObjectX}
${getObjectY}

and so on.

sure, i should code in MVC Logic, and i do whereever this is possible. But
sometimes, - so in protyping - or rapid prototyping - such approach would be
- at least in my opinion - a nice feature. 

alex





--
View this message in context: http://tapestry.1045711.n5.nabble.com/parameter-in-tml-page-tp5719561p5719645.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: parameter in tml page?

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Sun, 27 Jan 2013 12:18:47 -0200, sommeralex  
<al...@gmail.com> wrote:

> i dont wont a page property, i want to define the parameter dynamically  
> in the TML page itself.

Then you want to do something which is an anti-pattern, something that  
goes directly against the best practices: don't put logic in templates  
(.tml) files. If you do what you want, you'll have one hell of a difficult  
to understando and debug page.

-- 
Thiago H. de Paula Figueiredo

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


Re: parameter in tml page?

Posted by sommeralex <al...@gmail.com>.
what do you mean?


2013/1/27 Steve Eynon [via Tapestry] <
ml-node+s1045711n5719577h29@n5.nabble.com>

> Could you use:
>
> ComponentResources.getInformalParameter(String name, Class<T> type);
>
> ???
>
> Steve.
> --
> Steve Eynon
> -------------------------------
> "If at first you don't succeed,
>    so much for skydiving!"
>
>
>
> On 27 January 2013 22:18, sommeralex <[hidden email]<http://user/SendEmail.jtp?type=node&node=5719577&i=0>>
> wrote:
>
> > i dont wont a page property, i want to define the parameter dynamically
> in
> > the TML page itself.
> >
> > but it seems that this is not possible.
> >
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> http://tapestry.1045711.n5.nabble.com/parameter-in-tml-page-tp5719561p5719574.html
>
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5719577&i=1>
> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5719577&i=2>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5719577&i=3>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5719577&i=4>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://tapestry.1045711.n5.nabble.com/parameter-in-tml-page-tp5719561p5719577.html
>  To unsubscribe from parameter in tml page?, click here<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5719561&code=YWxleGFuZGVyLnNvbW1lckBnbWFpbC5jb218NTcxOTU2MXwxMDUzMzQxMzM4>
> .
> NAML<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://tapestry.1045711.n5.nabble.com/parameter-in-tml-page-tp5719561p5719582.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: parameter in tml page?

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Could you use:

ComponentResources.getInformalParameter(String name, Class<T> type);

???

Steve.
--
Steve Eynon
-------------------------------
"If at first you don't succeed,
   so much for skydiving!"



On 27 January 2013 22:18, sommeralex <al...@gmail.com> wrote:
> i dont wont a page property, i want to define the parameter dynamically in
> the TML page itself.
>
> but it seems that this is not possible.
>
>
>
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/parameter-in-tml-page-tp5719561p5719574.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

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


Re: parameter in tml page?

Posted by sommeralex <al...@gmail.com>.
i dont wont a page property, i want to define the parameter dynamically in
the TML page itself. 

but it seems that this is not possible.






--
View this message in context: http://tapestry.1045711.n5.nabble.com/parameter-in-tml-page-tp5719561p5719574.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: parameter in tml page?

Posted by Shing Hing Man <ma...@yahoo.com>.
I think you meant 


${getDescriptionForTag(user1)}


where user1 is a page property of type String. 

I think the above should work. 


Shing 

________________________________
From: sommeralex <al...@gmail.com>
To: users@tapestry.apache.org 
Sent: Sunday, January 27, 2013 10:54 AM
Subject: parameter in tml page?

is it possible to put parameters in a tml page?

eg:
Java:

String getDescriptionForTag(String tag){
   return descriptionService.getDescriptionForTag(tag);
}

TML:

<div>
User 1

${getDescription(user1)}
</div>


<div>
User 2

${getDescription(user2)}
</div>



--
View this message in context: http://tapestry.1045711.n5.nabble.com/parameter-in-tml-page-tp5719561.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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

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