You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kai Weber <ka...@glorybox.de> on 2009/06/11 15:38:13 UTC

Difference between prop: and ${...} in PageLink

Hi,

I am a Tapestry beginner. I am far from knowing all the internals. I use 
the PageLink component in one of my as follows:

@Component(id="backLink",
parameters={
   "page=${backLink}",
   "context=backLinkContext",
   "anchor=${prev.getUniqueIdentifier()}"})
private PageLink backLink;

My question is now

What does the ${...} do?

I fail to see what this means: If I replace 
"context=prop:backLinkContext" with "context=${backLinkContext}" I get a 
different link than expected. If I replace "page=prop:backLink" with 
"page=${backLink}" I get no different link. Why?

Kai

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


Re: Difference between prop: and ${...} in PageLink

Posted by Radek Terber <te...@b2bcentrum.cz>.
Hi all.

As I know from My experiments, ${ ... } converts each object to string,
in contrast to "prop:...", which returns object "as is". In page link,
this difference should not take an effect. But in parameters this is
significant ...


Kai Weber napsal(a):
> Hi,
>
> I am a Tapestry beginner. I am far from knowing all the internals. I
> use the PageLink component in one of my as follows:
>
> @Component(id="backLink",
> parameters={
>   "page=${backLink}",
>   "context=backLinkContext",
>   "anchor=${prev.getUniqueIdentifier()}"})
> private PageLink backLink;
>
> My question is now
>
> What does the ${...} do?
>
> I fail to see what this means: If I replace
> "context=prop:backLinkContext" with "context=${backLinkContext}" I get
> a different link than expected. If I replace "page=prop:backLink" with
> "page=${backLink}" I get no different link. Why?
>
> Kai
>
> ---------------------------------------------------------------------
> 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: Difference between prop: and ${...} in PageLink

Posted by Howard Lewis Ship <hl...@gmail.com>.
On Thu, Jun 11, 2009 at 7:05 AM, Onno Scheffers <on...@piraya.nl> wrote:

> ${} is a shortcut to make it very easy to insert some property-value into
> your template without having to use a component for it. There are typically
> 3 ways to insert some content into your page:
>
> 1. The way you're using components, keeping most of the configuration in
> the
> Java class:
> <h1 t:id="title">Some title</h1>
>
> @Component(parameters = { "value=prop:myTitle" })
> private Output output;
>
>
> 2. Use and configure the component straight from within your template:
> <h1 t:type="Output" t:value="prop:myTitle">Some title</h1>
>
>
> 3. The easiest way is using the expansion:
>  <h1>${myTitle}</h1>
>

You can also say ${message:my-key} to retrieve a localized key, or use any
other binding prefix.


>
>
> I use option 1 all the time. It makes refactoring much easier and keeps the
> templates clean for the designers. It takes more code though. This works
> for
> all components.
>
> Option 2 is typically great for quick prototyping but a lot of non-standard
> markup is added to the template which might confuse web-designers. It works
> for all components.
>
> Option 3 is a shortcut that makes it even easier to insert some property
> value directly into your page. It only works for inserting content
> retrieved
> from a property on your page.
>
> More information:
> http://tapestry.apache.org/tapestry5/guide/templates.html
>
>
> regards,
>
> Onno
>
>
> On Thu, Jun 11, 2009 at 3:38 PM, Kai Weber <ka...@glorybox.de> wrote:
>
> > Hi,
> >
> > I am a Tapestry beginner. I am far from knowing all the internals. I use
> > the PageLink component in one of my as follows:
> >
> > @Component(id="backLink",
> > parameters={
> >  "page=${backLink}",
> >  "context=backLinkContext",
> >  "anchor=${prev.getUniqueIdentifier()}"})
> > private PageLink backLink;
> >
> > My question is now
> >
> > What does the ${...} do?
> >
> > I fail to see what this means: If I replace
> "context=prop:backLinkContext"
> > with "context=${backLinkContext}" I get a different link than expected.
> If I
> > replace "page=prop:backLink" with "page=${backLink}" I get no different
> > link. Why?
> >
> > Kai
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

Re: Difference between prop: and ${...} in PageLink

Posted by Onno Scheffers <on...@piraya.nl>.
${} is a shortcut to make it very easy to insert some property-value into
your template without having to use a component for it. There are typically
3 ways to insert some content into your page:

1. The way you're using components, keeping most of the configuration in the
Java class:
<h1 t:id="title">Some title</h1>

@Component(parameters = { "value=prop:myTitle" })
private Output output;


2. Use and configure the component straight from within your template:
<h1 t:type="Output" t:value="prop:myTitle">Some title</h1>


3. The easiest way is using the expansion:
 <h1>${myTitle}</h1>


I use option 1 all the time. It makes refactoring much easier and keeps the
templates clean for the designers. It takes more code though. This works for
all components.

Option 2 is typically great for quick prototyping but a lot of non-standard
markup is added to the template which might confuse web-designers. It works
for all components.

Option 3 is a shortcut that makes it even easier to insert some property
value directly into your page. It only works for inserting content retrieved
from a property on your page.

More information: http://tapestry.apache.org/tapestry5/guide/templates.html


regards,

Onno


On Thu, Jun 11, 2009 at 3:38 PM, Kai Weber <ka...@glorybox.de> wrote:

> Hi,
>
> I am a Tapestry beginner. I am far from knowing all the internals. I use
> the PageLink component in one of my as follows:
>
> @Component(id="backLink",
> parameters={
>  "page=${backLink}",
>  "context=backLinkContext",
>  "anchor=${prev.getUniqueIdentifier()}"})
> private PageLink backLink;
>
> My question is now
>
> What does the ${...} do?
>
> I fail to see what this means: If I replace "context=prop:backLinkContext"
> with "context=${backLinkContext}" I get a different link than expected. If I
> replace "page=prop:backLink" with "page=${backLink}" I get no different
> link. Why?
>
> Kai
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Difference between prop: and ${...} in PageLink

Posted by Howard Lewis Ship <hl...@gmail.com>.
${...} expansions evaluate the expression and convert it to a string.

Since the page parameter expects a string, that's OK.

Converting a context (an array or List to a string) is different than
passing the List, unchanged, as the context parameter.

Allowing ${...} expansions in attribute values was added for ordinary,
non-component, elements that want a little bit of dynamic behavior.  For
components, use the prop: binding prefix. This is expecially important for
form components such as TextArea, as prop:somePageProperty is read/write
(the TextField can update the property when the form is submitted), whereas
${somePageProperty} is converted to a string and is read-only.

On Thu, Jun 11, 2009 at 6:38 AM, Kai Weber <ka...@glorybox.de> wrote:

> Hi,
>
> I am a Tapestry beginner. I am far from knowing all the internals. I use
> the PageLink component in one of my as follows:
>
> @Component(id="backLink",
> parameters={
>  "page=${backLink}",
>  "context=backLinkContext",
>  "anchor=${prev.getUniqueIdentifier()}"})
> private PageLink backLink;
>
> My question is now
>
> What does the ${...} do?
>
> I fail to see what this means: If I replace "context=prop:backLinkContext"
> with "context=${backLinkContext}" I get a different link than expected. If I
> replace "page=prop:backLink" with "page=${backLink}" I get no different
> link. Why?
>
> Kai
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos