You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by manuel aldana <al...@gmx.de> on 2009/02/13 02:24:29 UTC

[T5] filter on parameters

Hi,

a question on @Parameter:

@Parameter
private String param;

1) How is it possible to filter a passed param (e.g. manipulating the 
value)? Using getters and setters for that would not work.
2) How can I make the parameter available to the template (e.g. to 
render this), i.e. want to have it passed as a parameter but want to 
render it as a property in my component.

thanks.

-- 
 manuel aldana
 aldana@gmx.de
 software-engineering blog: http://www.aldana-online.de


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


Re: [T5] filter on parameters

Posted by Robert Zeigler <ro...@scazdl.org>.
On Feb 12, 2009, at 2/127:24 PM , manuel aldana wrote:

> Hi,
>
> a question on @Parameter:
>
> @Parameter
> private String param;
>
> 1) How is it possible to filter a passed param (e.g. manipulating  
> the value)? Using getters and setters for that would not work.

Generally, the "setupRender" phase is what you want to use:

@SetupRender //annotation is redundant if the method name is setupRender
void setupRender() {
	//manipulate "param" parameter here...
	param = param==null?null:param.replaceAll("a","b");
}

This method will be called before the component renders.
See: http://tapestry.apache.org/tapestry5/guide/rendering.html

> 2) How can I make the parameter available to the template (e.g. to  
> render this), i.e. want to have it passed as a parameter but want to  
> render it as a property in my component.
>


@Parameter
@Property
private String param;

Or:

@Parameter
private String param;

public String getParam() {
	return param;
}

Robert

> thanks.
>
> -- 
> manuel aldana
> aldana@gmx.de
> software-engineering blog: http://www.aldana-online.de
>
>
> ---------------------------------------------------------------------
> 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