You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Eng Lark Eric Tan <ne...@yahoo.com.hk> on 2005/06/20 11:56:49 UTC

Why my Foreach fail?

Dear all,

I have prepare "allLink" in 3 parts. Why it still have
error? Looking forward for your comment.

Eric Tan

Unable to resolve expression 'allLink' for
page.Main@19f5e3f[Main].
binding:  	ExpressionBinding[Main allLink]
location: 	context:/WEB-INF/Main.page, line 44, column
54

ognl.NoSuchPropertyException
allLink

Main.page

...
    <component id="foreach" type="Foreach">
        <binding name="source" expression="allLink"/>
    </component>
    <component id="link" type="PageLink">
        <static-binding name="page" value="UsrMain"/>
    </component>
...

Main.html
<span jwcid="foreach">
    <span jwcid="link"/>
</span>

Main.java

public List getAllLink() {
		allLink = new ArrayList();
		allLink.add("Page1");
		allLink.add("Page2");
		allLink.add("Page3");
		return allLink;
}

_______________________________________
 想即時收到新 email 通知?
 下載 Yahoo! Messenger http://messenger.yahoo.com.hk 

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


RE: Why my Foreach fail?

Posted by Eng Lark Eric Tan <ne...@yahoo.com.hk>.
Thank you very much!

Finally, I find out the reason. It is a stupid bug.

.java
public abstract class MyPage extends BasePage{
}

.page
<page-specification
class="org.apache.tapestry.html.BasePage">

I should 
<page-specification class="pkg.MyPage">

Ah!! It takes me serveral hours to find out this
bug!!!

--- "seloha ." <se...@hotmail.com> 說:

> I think what you need is something like this:
> 
> in .page:
> 
>    <property name="aLink" type="java.lang.String"/>
> 
>     <component id="foreach" type="Foreach">
>         <binding name="source"
> expression="allLink"/>
>         <binding name="value" expression="aLink"/>
>     </component>
> 
> in .html:
> 
> <span jwcid="foreach">
>   <span jwcid="@Insert" value="ognl:aLink"/>
> </span>
> 
> 
> in .java:
> 
>     public abstract String getALink();
>     public abstract void setALink(String aLink);
> 
> This may not be spot on but I think the problem is
> that you need a value in 
> the foreach to set each iteration to, you then use
> this to display what you 
> want.
> 
> Paul
> 
> 
> Eng Lark Eric Tan <ne...@yahoo.com.hk> wrote:
> 
> Dear all,
> 
> I have prepare "allLink" in 3 parts. Why it still
> have
> error? Looking forward for your comment.
> 
> Eric Tan
> 
> Unable to resolve expression 'allLink' for
> page.Main@19f5e3f[Main].
> binding:  	ExpressionBinding[Main allLink]
> location: 	context:/WEB-INF/Main.page, line 44,
> column
> 54
> 
> ognl.NoSuchPropertyException
> allLink
> 
> Main.page
> 
> ...
>     <component id="foreach" type="Foreach">
>         <binding name="source"
> expression="allLink"/>
>     </component>
>     <component id="link" type="PageLink">
>         <static-binding name="page"
> value="UsrMain"/>
>     </component>
> ...
> 
> Main.html
> <span jwcid="foreach">
>     <span jwcid="link"/>
> </span>
> 
> Main.java
> 
> public List getAllLink() {
> 		allLink = new ArrayList();
> 		allLink.add("Page1");
> 		allLink.add("Page2");
> 		allLink.add("Page3");
> 		return allLink;
> }
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 
> 


_______________________________________
 想即時收到新 email 通知?
 下載 Yahoo! Messenger http://messenger.yahoo.com.hk 

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


RE: Why my Foreach fail?

Posted by "seloha ." <se...@hotmail.com>.
I think what you need is something like this:

in .page:

   <property name="aLink" type="java.lang.String"/>

    <component id="foreach" type="Foreach">
        <binding name="source" expression="allLink"/>
        <binding name="value" expression="aLink"/>
    </component>

in .html:

<span jwcid="foreach">
  <span jwcid="@Insert" value="ognl:aLink"/>
</span>


in .java:

    public abstract String getALink();
    public abstract void setALink(String aLink);

This may not be spot on but I think the problem is that you need a value in 
the foreach to set each iteration to, you then use this to display what you 
want.

Paul


Eng Lark Eric Tan <ne...@yahoo.com.hk> wrote:

Dear all,

I have prepare "allLink" in 3 parts. Why it still have
error? Looking forward for your comment.

Eric Tan

Unable to resolve expression 'allLink' for
page.Main@19f5e3f[Main].
binding:  	ExpressionBinding[Main allLink]
location: 	context:/WEB-INF/Main.page, line 44, column
54

ognl.NoSuchPropertyException
allLink

Main.page

...
    <component id="foreach" type="Foreach">
        <binding name="source" expression="allLink"/>
    </component>
    <component id="link" type="PageLink">
        <static-binding name="page" value="UsrMain"/>
    </component>
...

Main.html
<span jwcid="foreach">
    <span jwcid="link"/>
</span>

Main.java

public List getAllLink() {
		allLink = new ArrayList();
		allLink.add("Page1");
		allLink.add("Page2");
		allLink.add("Page3");
		return allLink;
}



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