You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Aleksej <al...@ivs.lt> on 2005/11/23 09:04:19 UTC

T4 Component parameters binding using not abstract setters

I have such problem:
I have component which belongs of my page parameter ( categoryId )
and I want to write setter
void setCategoryId( int categoryId ) throws CategoryNotFoundException
{
// ???this code is never called and I dont know why
}
with some logic which loads Category object
into component and become available from getter
Category getCategory()

in my component file I have parameter defined like
<parameter name="categoryId" required="no" />

in my page file I use such component like:
<span jwcid="Path" categoryId="ognl:categoryId" />
and given ognl expression returns valid value but component setter is 
never called,
can someone explain why?


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


Re: T4 Component parameters binding using not abstract setters

Posted by Gunna Satria Hijrah Kusumah <gn...@nwa.iao.co.id>.
Hi Aleksej,

just trying to help, this is based on my experience in tapestry 3.
i think tapestry only call abstract method of setCategoryId or 
setCategoryIdBinding(if you define the direction as custom).
i guest what you trying to do is get Category object based on the categoryid 
provided from page that using the component.
a suggestion, why don't you put your logic to load Category object in your 
getCategory method.
maybe like this:

public abstract int getCategoriId();
public abstract void setCategoriId(int categoryId);
protected Category category;
public Category getCategory(){
	if(null==category){
		category = loadCategoryFromId(getCategoryId());
	}
	return category;
}

regards,

Gunna
On Wednesday 23 November 2005 15:04, Aleksej wrote:
> I have such problem:
> I have component which belongs of my page parameter ( categoryId )
> and I want to write setter
> void setCategoryId( int categoryId ) throws CategoryNotFoundException
> {
> // ???this code is never called and I dont know why
> }
> with some logic which loads Category object
> into component and become available from getter
> Category getCategory()
>
> in my component file I have parameter defined like
> <parameter name="categoryId" required="no" />
>
> in my page file I use such component like:
> <span jwcid="Path" categoryId="ognl:categoryId" />
> and given ognl expression returns valid value but component setter is
> never called,
> can someone explain why?
>
>
> ---------------------------------------------------------------------
> 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