You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tim Sawyer <ts...@calidris.co.uk> on 2005/06/29 16:39:46 UTC

Component Parameters

I've just upgraded to Tapestry 4, and a problem I had a few days back has reared it's head again.  I thought I'd understood this.

I have a page, which contains the following:

<span jwcid="@UrlEncodedFlashGraphSmall" encodedUrl="ognl:visit.chartUrl"/>

The UrlEncodedFlashGraphSmall component is defined as

<component-specification allow-body="no" allow-informal-parameters="no" class="com.company.misconsole.component.flashgraph.UrlEncodedFlashGraphSmall">
  <parameter name="encodedUrl" required="yes"/>
</component-specification>

The class for this component has a method, setEncodedUrl which does not seem to be being called.

public void setEncodedUrl(String pEncodedUrl)
{
  if (AbstractFlashGraph.logger.isDebugEnabled())
  {
    AbstractFlashGraph.logger.debug("SetEncodedURL to " + pEncodedUrl);
  }

-snip-

This debug is not being output, even though it is turned on.

I'm assuming that Tapestry is using it's own internal attribute (like it would if I didn't have the set method defined myself).  How can I make it run my set method?  This worked in 3.0.2 before I upgraded.

Any thoughts would be appreciated.

Tim.







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


Re: Component Parameters

Posted by Norbert Sándor <de...@erinors.com>.
Why would you like to have it called? Maybe there is a better solution for 
your problem.
(For example: create a   public abstract String getEncodedUrl();     in Java 
code and use it to access the value bound to the parameter. Or use lazy 
initialization for data related to this parameter.)

Besides, for a long time I thought that Tapestry does not allow this kind of 
parameter accessor definition, only abstract accessors. But some weeks ago I 
saw that it is possible in Tapestry 3 as well, like in your example. The 
developers can tell you why this is permitted...
As I know, the setEncodedUrl() in your example is not called by the 
framework, instead you can call it to set the value of the parameter's 
binding (in this case the method should be abstract).
Of course this is not what you want...

Br,
Norbi

----- Original Message ----- 
From: "Tim Sawyer" <ts...@calidris.co.uk>
To: <ta...@jakarta.apache.org>
Cc: "Tim Sawyer" <ts...@calidris.co.uk>
Sent: Wednesday, June 29, 2005 4:39 PM
Subject: Component Parameters


> I've just upgraded to Tapestry 4, and a problem I had a few days back has 
> reared it's head again.  I thought I'd understood this.
>
> I have a page, which contains the following:
>
> <span jwcid="@UrlEncodedFlashGraphSmall" 
> encodedUrl="ognl:visit.chartUrl"/>
>
> The UrlEncodedFlashGraphSmall component is defined as
>
> <component-specification allow-body="no" allow-informal-parameters="no" 
> class="com.company.misconsole.component.flashgraph.UrlEncodedFlashGraphSmall">
>  <parameter name="encodedUrl" required="yes"/>
> </component-specification>
>
> The class for this component has a method, setEncodedUrl which does not 
> seem to be being called.
>
> public void setEncodedUrl(String pEncodedUrl)
> {
>  if (AbstractFlashGraph.logger.isDebugEnabled())
>  {
>    AbstractFlashGraph.logger.debug("SetEncodedURL to " + pEncodedUrl);
>  }
>
> -snip-
>
> This debug is not being output, even though it is turned on.
>
> I'm assuming that Tapestry is using it's own internal attribute (like it 
> would if I didn't have the set method defined myself).  How can I make it 
> run my set method?  This worked in 3.0.2 before I upgraded.
>
> Any thoughts would be appreciated.
>
> Tim.
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
> 



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