You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Rolf Strijdhorst <ro...@gmail.com> on 2006/01/16 12:50:57 UTC
Component annontation and For component
Hi I am trying to replace my .page file with annotations
but when I am using the @Component with a For Component I got an Exception.
this is my annotated code:
@Persist
public abstract Product getCurrentProduct();
public abstract void setCurrentProduct(Product product);
@Component(id="products", type="For", bindings= {"source=Products",
"value=currentProduct", "element=tr"})
public Iterator getProducts() {
return Catalog.getGlobalCatalog().getProducts().iterator();
}
and this is my working .page file snipped:
<property name="currentProduct"/>
<component id="products" type="For">
<binding name="source" value="ognl:products"/>
<binding name="value" value="currentProduct"/>
<binding name="element" value="literal:tr"/>
</component>
And this is the exception i get when using the annotated code:
org.apache.hivemind.ApplicationRuntimeException Component Home/products is
not assignable to type java.util.Iterator. location: Annotation @
org.apache.tapestry.annotations.Component(inheritInformalParameters=false,
bindings=[source=Products, value=currentProduct, element=tr], id=products,
type=For) of public java.util.Iterator
org.comptour.tapestry.Home.getProducts() Stack Trace:
- org.apache.tapestry.TapestryUtils.getComponent(TapestryUtils.java:304)
- $Home_28.finishLoad($Home_28.java)
- org.apache.tapestry.pageload.PageLoader.constructComponent(
PageLoader.java:439)
- org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:613)
....
what could be the Issue??
Thanx
Rolf
Re: Component annontation and For component
Posted by Rolf Strijdhorst <ro...@gmail.com>.
Sorry to bother you all (again ;-))
I should have created an abstract method that returned the Form component.
and should not have anotated the the source of the component.
On 1/16/06, Rolf Strijdhorst <ro...@gmail.com> wrote:
>
> Hi I am trying to replace my .page file with annotations
> but when I am using the @Component with a For Component I got an
> Exception.
>
> this is my annotated code:
>
> @Persist
> public abstract Product getCurrentProduct();
> public abstract void setCurrentProduct(Product product);
>
> @Component(id="products", type="For", bindings= {"source=Products",
> "value=currentProduct", "element=tr"})
> public Iterator getProducts() {
> return Catalog.getGlobalCatalog().getProducts().iterator();
> }
>
> and this is my working .page file snipped:
>
> <property name="currentProduct"/>
> <component id="products" type="For">
> <binding name="source" value="ognl:products"/>
> <binding name="value" value="currentProduct"/>
> <binding name="element" value="literal:tr"/>
> </component>
>
> And this is the exception i get when using the annotated code:
> org.apache.hivemind.ApplicationRuntimeException Component Home/products
> is not assignable to type java.util.Iterator. location: Annotation @
> org.apache.tapestry.annotations.Component(inheritInformalParameters=false,
> bindings=[source=Products, value=currentProduct, element=tr], id=products,
> type=For) of public java.util.Iterator
> org.comptour.tapestry.Home.getProducts() Stack Trace:
>
> - org.apache.tapestry.TapestryUtils.getComponent(TapestryUtils.java:304)
>
> - $Home_28.finishLoad($Home_28.java)
> - org.apache.tapestry.pageload.PageLoader.constructComponent(
> PageLoader.java:439)
> - org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:613)
>
>
> ....
>
> what could be the Issue??
>
> Thanx
> Rolf
>