You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alex Kravets <ak...@kligerweiss.com> on 2005/03/31 22:21:05 UTC

running example

I am experimenting with currency converter from this tutorial: 
http://www2.cpttm.org.mo/cyberlab/softdev/tapestry/.
When I run application I get an exception:
org.apache.tapestry.BindingException
Unable to resolve expression 'okListener' for 
org.apache.tapestry.html.BasePage@103d246[Home].
binding: 	ExpressionBinding[Home okListener]
location: 	context:/WEB-INF/Home.page, line 10, column 56
 
ognl.NoSuchPropertyException
okListener


I have all the files as in tutorial, but have no idea what's going on. 
Obviously it can't link Home.page with Home.java, but why?

Home.page
========
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification
      PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
      "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<!-- generated by Spindle, http://spindle.sourceforge.net -->

<page-specification class="helloworld.Home">
    <description><![CDATA[   add a description   ]]></description>
        <component id="currencyConverterForm" type="Form">
                   <binding name="listener" expression="okListener"/>
        </component>
</page-specification>

Home.java
========
package helloworld;

import org.apache.tapestry.*;
import org.apache.tapestry.html.*;

public class Home extends BasePage {
        public IActionListener getOkListener() {
                return new IActionListener() {
                        public void actionTriggered( IComponent 
component, IRequestCycle cycle) {
                                cycle.activate("Result");
                        }
                };
        }
}

thanks,
Alex


Re: running example

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Mar 31, 2005, at 4:50 PM, Ron Piterman wrote:

> ציטוט Alex Kravets:
>> thanks Geoff,
>> So the example was wrong then? And as I understand when I define a 
>> binding with name listener it will always be put into map by 
>> Tapestry?
>
>
> note that it is not "listeners:okListener" but "listeners.okListener".

That is true in 3.0...
However note that in 3.1 in addition to "ognl:listeners.okListener" 
that "listener:okListener" is also acceptable.

	Erik


>
> Ognl calls getListeners(), gets a custom map implementation, which, 
> when
> get(key) is called, constructs a listener which will call your, in 
> this case, okListener method. (or so I understand it) - this saves you 
> much time in implementing real listener implementations.
>
> You can define your own listener implementation though and supply it 
> in the binding.
>
>
>> Geoff Longman wrote:
>>> and the java to:
>>>
>>> public class Home extends BasePage {
>>>
>>>
>>>   public void okListener(IrequestCycle cycle) {
>>> cycle.activate("Result");
>>> }
>>>
>>> }
>>>  IActionListeners are create for you by Tapestry and hooked to the
>>> methods with sigs as above. These synthetic listeners are stored in a
>>> map called "listeners" hence the ognl expression
>>> "listeners.okListener".
>>>
>>> Geoff
>>>
>>>
>>> On Thu, 31 Mar 2005 14:51:57 -0600, Geoff Longman 
>>> <gl...@gmail.com> wrote:
>>>
>>>> change:
>>>>
>>>> <binding name="listener" expression="okListener"/>
>>>>
>>>> to:
>>>>
>>>> <binding name="listener" expression="listeners.okListener"/>
>>>>
>>>> Geoff
>>>>
>>>>
>>>> On Thu, 31 Mar 2005 15:21:05 -0500, Alex Kravets
>>>> <akravets@kligerweiss.com > wrote:
>>>>
>>>>> I am experimenting with currency converter from this tutorial:
>>>>> http://www2.cpttm.org.mo/cyberlab/softdev/tapestry/ .
>>>>> When I run application I get an exception:
>>>>> org.apache.tapestry.BindingException
>>>>> Unable to resolve expression 'okListener' for
>>>>> org.apache.tapestry.html.BasePage@103d246[Home].
>>>>> binding:        ExpressionBinding[Home okListener]
>>>>> location:       context:/WEB-INF/Home.page, line 10, column 56
>>>>>
>>>>> ognl.NoSuchPropertyException
>>>>> okListener
>>>>>
>>>>> I have all the files as in tutorial, but have no idea what's going 
>>>>> on.
>>>>> Obviously it can't link Home.page with Home.java, but why?
>>>>>
>>>>> Home.page
>>>>> ========
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <!DOCTYPE page-specification
>>>>>      PUBLIC "-//Apache Software Foundation//Tapestry Specification 
>>>>> 3.0//EN"
>>>>>      "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd " >
>>>>> <!-- generated by Spindle, http://spindle.sourceforge.net -->
>>>>>
>>>>> <page-specification class="helloworld.Home">
>>>>>    <description><![CDATA[   add a description   ]]></description>
>>>>>        <component id="currencyConverterForm" type="Form">
>>>>>                   <binding name="listener" 
>>>>> expression="okListener"/>
>>>>>        </component>
>>>>> </page-specification>
>>>>>
>>>>> Home.java
>>>>> ========
>>>>> package helloworld;
>>>>>
>>>>> import org.apache.tapestry.*;
>>>>> import org.apache.tapestry.html.*;
>>>>>
>>>>> public class Home extends BasePage {
>>>>>        public IActionListener getOkListener() {
>>>>>                return new IActionListener() {
>>>>>                        public void actionTriggered( IComponent
>>>>> component, IRequestCycle cycle) {
>>>>>                                cycle.activate("Result");
>>>>>                        }
>>>>>                };
>>>>>        }
>>>>> }
>>>>>
>>>>> thanks,
>>>>> Alex
>>>>>
>>>>>
>>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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


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


Re: Inheritance???

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Mar 31, 2005, at 5:22 PM, david joffrin wrote:

> Hi,
>
> I have a class A like that:
> class A {
> public boolean isMale() {...};
> }
> my html A is using isMale with a Conditional component.
>
> I have now a class B like that:
> class A extends B {
> ...
> }
> my html B is using isMale as well... however, I have the following 
> exception:
> Unable to resolve expression '! subCategory' for 
> com.etil.sudetp.presentation.http.page.B$Enhance_72@124bd93[B].

What does "subCategory" have to do with "isMale"?

Inheritance works just fine with methods like this, or at least it 
should - perhaps its just the mismatch of methods here?

	Erik


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


Inheritance???

Posted by david joffrin <da...@hotmail.com>.
Hi,

I have a class A like that:
class A {
public boolean isMale() {...};
}
my html A is using isMale with a Conditional component.

I have now a class B like that:
class A extends B {
...
}
my html B is using isMale as well... however, I have the following 
exception:
Unable to resolve expression '! subCategory' for 
com.etil.sudetp.presentation.http.page.B$Enhance_72@124bd93[B].

In the past, I copied and pasted the methods again and again, but I am sure 
there is a better solution. Am I right?

Thanks.
DvJ



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


Re: running example

Posted by Ron Piterman <mp...@vollbio.de>.
ציטוט Alex Kravets:
> thanks Geoff,
> 
> So the example was wrong then? And as I understand when I define a 
> binding with name listener it will always be put into map by Tapestry?


note that it is not "listeners:okListener" but "listeners.okListener".

Ognl calls getListeners(), gets a custom map implementation, which, when
get(key) is called, constructs a listener which will call your, in this 
case, okListener method. (or so I understand it) - this saves you much 
time in implementing real listener implementations.

You can define your own listener implementation though and supply it in 
the binding.


> 
> Geoff Longman wrote:
> 
>> and the java to:
>>
>> public class Home extends BasePage {
>>
>>
>>   public void okListener(IrequestCycle cycle) {
>> cycle.activate("Result");
>> }
>>
>> }
>>  
>> IActionListeners are create for you by Tapestry and hooked to the
>> methods with sigs as above. These synthetic listeners are stored in a
>> map called "listeners" hence the ognl expression
>> "listeners.okListener".
>>
>> Geoff
>>
>>
>> On Thu, 31 Mar 2005 14:51:57 -0600, Geoff Longman <gl...@gmail.com> 
>> wrote:
>>  
>>
>>> change:
>>>
>>> <binding name="listener" expression="okListener"/>
>>>
>>> to:
>>>
>>> <binding name="listener" expression="listeners.okListener"/>
>>>
>>> Geoff
>>>
>>>
>>> On Thu, 31 Mar 2005 15:21:05 -0500, Alex Kravets
>>> <akravets@kligerweiss.com > wrote:
>>>   
>>>
>>>> I am experimenting with currency converter from this tutorial:
>>>> http://www2.cpttm.org.mo/cyberlab/softdev/tapestry/ .
>>>> When I run application I get an exception:
>>>> org.apache.tapestry.BindingException
>>>> Unable to resolve expression 'okListener' for
>>>> org.apache.tapestry.html.BasePage@103d246[Home].
>>>> binding:        ExpressionBinding[Home okListener]
>>>> location:       context:/WEB-INF/Home.page, line 10, column 56
>>>>
>>>> ognl.NoSuchPropertyException
>>>> okListener
>>>>
>>>> I have all the files as in tutorial, but have no idea what's going on.
>>>> Obviously it can't link Home.page with Home.java, but why?
>>>>
>>>> Home.page
>>>> ========
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <!DOCTYPE page-specification
>>>>      PUBLIC "-//Apache Software Foundation//Tapestry Specification 
>>>> 3.0//EN"
>>>>      "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd " >
>>>> <!-- generated by Spindle, http://spindle.sourceforge.net -->
>>>>
>>>> <page-specification class="helloworld.Home">
>>>>    <description><![CDATA[   add a description   ]]></description>
>>>>        <component id="currencyConverterForm" type="Form">
>>>>                   <binding name="listener" expression="okListener"/>
>>>>        </component>
>>>> </page-specification>
>>>>
>>>> Home.java
>>>> ========
>>>> package helloworld;
>>>>
>>>> import org.apache.tapestry.*;
>>>> import org.apache.tapestry.html.*;
>>>>
>>>> public class Home extends BasePage {
>>>>        public IActionListener getOkListener() {
>>>>                return new IActionListener() {
>>>>                        public void actionTriggered( IComponent
>>>> component, IRequestCycle cycle) {
>>>>                                cycle.activate("Result");
>>>>                        }
>>>>                };
>>>>        }
>>>> }
>>>>
>>>> thanks,
>>>> Alex
>>>>
>>>>
>>>>     
>>
>>
>> ---------------------------------------------------------------------
>> 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


Re: running example

Posted by Kent Tong <ke...@cpttm.org.mo>.
Alex Kravets <akravets <at> kligerweiss.com> writes:

> 
> thanks for the clarification.
> But what does disabling the cache has to do with it? 

Because your Home.page was:

<page-specification class="...BasePage">

but later you changed it to:

<page-specification class="...Home">

As the cache is not disabled, Tapestry is still using
the old version.

> As earlier posts 
> say that okListener is retrieved from listeners map.

No. It depends on the binding. For the binding used
in the tutorial:

<binding name="listener" expression="okListener"/>

It will call getOkListener() on the page object. For
a binding like:

<binding name="listener" expression="listeners.okListener"/>

It will get the listener from the listeners map.



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


Re: running example

Posted by Alex Kravets <ak...@kligerweiss.com>.
thanks for the clarification.
But what does disabling the cache has to do with it? As earlier posts 
say that okListener is retrieved from listeners map.

Kent Tong wrote:

>Alex Kravets <akravets <at> kligerweiss.com> writes:
>
>  
>
>>So the example was wrong then? 
>>    
>>
>
>As the author of the tutorial, I have to jump in :-)
>No, it is not wrong. So, what's wrong? The error 
>message says it all:
>
>Unable to resolve expression 'okListener' for 
>org.apache.tapestry.html.BasePage <at> 103d246[Home].
>
>It means Tapestry is still using BasePage as the page
>object for your Home page (not Home.java), even although 
>your Home.page is:
>
><page-specification class="helloworld.Home">
>  ...
></page-specification>
>
>The most likely reason is that you have not been
>successful in disabling the cache in Tapestry.
>
>  
>
>>And as I understand when I define a 
>>binding with name listener it will always be put into map by Tapestry?
>>    
>>
>
>No. Only when its method signature looks like a listener:
>
>public void XXX(IRequestCycle yyy) {
>  ...
>}
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>

Re: running example

Posted by Kent Tong <ke...@cpttm.org.mo>.
Alex Kravets <akravets <at> kligerweiss.com> writes:

> So the example was wrong then? 

As the author of the tutorial, I have to jump in :-)
No, it is not wrong. So, what's wrong? The error 
message says it all:

Unable to resolve expression 'okListener' for 
org.apache.tapestry.html.BasePage <at> 103d246[Home].

It means Tapestry is still using BasePage as the page
object for your Home page (not Home.java), even although 
your Home.page is:

<page-specification class="helloworld.Home">
  ...
</page-specification>

The most likely reason is that you have not been
successful in disabling the cache in Tapestry.

> And as I understand when I define a 
> binding with name listener it will always be put into map by Tapestry?

No. Only when its method signature looks like a listener:

public void XXX(IRequestCycle yyy) {
  ...
}



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


Re: running example

Posted by Alex Kravets <ak...@kligerweiss.com>.
thanks Geoff,

So the example was wrong then? And as I understand when I define a 
binding with name listener it will always be put into map by Tapestry?

Geoff Longman wrote:

>and the java to:
>
>public class Home extends BasePage {
>
>
>   public void okListener(IrequestCycle cycle) {
> cycle.activate("Result");
>}
>
>}
>   
>
>IActionListeners are create for you by Tapestry and hooked to the
>methods with sigs as above. These synthetic listeners are stored in a
>map called "listeners" hence the ognl expression
>"listeners.okListener".
>
>Geoff
>
>
>On Thu, 31 Mar 2005 14:51:57 -0600, Geoff Longman <gl...@gmail.com> wrote:
>  
>
>>change:
>>
>><binding name="listener" expression="okListener"/>
>>
>>to:
>>
>><binding name="listener" expression="listeners.okListener"/>
>>
>>Geoff
>>
>>
>>On Thu, 31 Mar 2005 15:21:05 -0500, Alex Kravets
>><akravets@kligerweiss.com > wrote:
>>    
>>
>>>I am experimenting with currency converter from this tutorial:
>>>http://www2.cpttm.org.mo/cyberlab/softdev/tapestry/ .
>>>When I run application I get an exception:
>>>org.apache.tapestry.BindingException
>>>Unable to resolve expression 'okListener' for
>>>org.apache.tapestry.html.BasePage@103d246[Home].
>>>binding:        ExpressionBinding[Home okListener]
>>>location:       context:/WEB-INF/Home.page, line 10, column 56
>>>
>>>ognl.NoSuchPropertyException
>>>okListener
>>>
>>>I have all the files as in tutorial, but have no idea what's going on.
>>>Obviously it can't link Home.page with Home.java, but why?
>>>
>>>Home.page
>>>========
>>><?xml version="1.0" encoding="UTF-8"?>
>>><!DOCTYPE page-specification
>>>      PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
>>>      "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd " >
>>><!-- generated by Spindle, http://spindle.sourceforge.net -->
>>>
>>><page-specification class="helloworld.Home">
>>>    <description><![CDATA[   add a description   ]]></description>
>>>        <component id="currencyConverterForm" type="Form">
>>>                   <binding name="listener" expression="okListener"/>
>>>        </component>
>>></page-specification>
>>>
>>>Home.java
>>>========
>>>package helloworld;
>>>
>>>import org.apache.tapestry.*;
>>>import org.apache.tapestry.html.*;
>>>
>>>public class Home extends BasePage {
>>>        public IActionListener getOkListener() {
>>>                return new IActionListener() {
>>>                        public void actionTriggered( IComponent
>>>component, IRequestCycle cycle) {
>>>                                cycle.activate("Result");
>>>                        }
>>>                };
>>>        }
>>>}
>>>
>>>thanks,
>>>Alex
>>>
>>>
>>>      
>>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>

Re: running example

Posted by Geoff Longman <gl...@gmail.com>.
and the java to:

public class Home extends BasePage {


   public void okListener(IrequestCycle cycle) {
 cycle.activate("Result");
}

}
   

IActionListeners are create for you by Tapestry and hooked to the
methods with sigs as above. These synthetic listeners are stored in a
map called "listeners" hence the ognl expression
"listeners.okListener".

Geoff


On Thu, 31 Mar 2005 14:51:57 -0600, Geoff Longman <gl...@gmail.com> wrote:
> change:
> 
> <binding name="listener" expression="okListener"/>
> 
> to:
> 
> <binding name="listener" expression="listeners.okListener"/>
> 
> Geoff
> 
> 
> On Thu, 31 Mar 2005 15:21:05 -0500, Alex Kravets
> <akravets@kligerweiss.com > wrote:
> > I am experimenting with currency converter from this tutorial:
> > http://www2.cpttm.org.mo/cyberlab/softdev/tapestry/ .
> > When I run application I get an exception:
> > org.apache.tapestry.BindingException
> > Unable to resolve expression 'okListener' for
> > org.apache.tapestry.html.BasePage@103d246[Home].
> > binding:        ExpressionBinding[Home okListener]
> > location:       context:/WEB-INF/Home.page, line 10, column 56
> >
> > ognl.NoSuchPropertyException
> > okListener
> >
> > I have all the files as in tutorial, but have no idea what's going on.
> > Obviously it can't link Home.page with Home.java, but why?
> >
> > Home.page
> > ========
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE page-specification
> >       PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
> >       "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd " >
> > <!-- generated by Spindle, http://spindle.sourceforge.net -->
> >
> > <page-specification class="helloworld.Home">
> >     <description><![CDATA[   add a description   ]]></description>
> >         <component id="currencyConverterForm" type="Form">
> >                    <binding name="listener" expression="okListener"/>
> >         </component>
> > </page-specification>
> >
> > Home.java
> > ========
> > package helloworld;
> >
> > import org.apache.tapestry.*;
> > import org.apache.tapestry.html.*;
> >
> > public class Home extends BasePage {
> >         public IActionListener getOkListener() {
> >                 return new IActionListener() {
> >                         public void actionTriggered( IComponent
> > component, IRequestCycle cycle) {
> >                                 cycle.activate("Result");
> >                         }
> >                 };
> >         }
> > }
> >
> > thanks,
> > Alex
> >
> >
>

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


Re: running example

Posted by Geoff Longman <gl...@gmail.com>.
change:

<binding name="listener" expression="okListener"/>

to:

<binding name="listener" expression="listeners.okListener"/>

Geoff


On Thu, 31 Mar 2005 15:21:05 -0500, Alex Kravets
<ak...@kligerweiss.com> wrote:
> I am experimenting with currency converter from this tutorial:
> http://www2.cpttm.org.mo/cyberlab/softdev/tapestry/ .
> When I run application I get an exception:
> org.apache.tapestry.BindingException
> Unable to resolve expression 'okListener' for
> org.apache.tapestry.html.BasePage@103d246[Home].
> binding:        ExpressionBinding[Home okListener]
> location:       context:/WEB-INF/Home.page, line 10, column 56
> 
> ognl.NoSuchPropertyException
> okListener
> 
> I have all the files as in tutorial, but have no idea what's going on.
> Obviously it can't link Home.page with Home.java, but why?
> 
> Home.page
> ========
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE page-specification
>       PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
>       "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd" >
> <!-- generated by Spindle, http://spindle.sourceforge.net -->
> 
> <page-specification class="helloworld.Home">
>     <description><![CDATA[   add a description   ]]></description>
>         <component id="currencyConverterForm" type="Form">
>                    <binding name="listener" expression="okListener"/>
>         </component>
> </page-specification>
> 
> Home.java
> ========
> package helloworld;
> 
> import org.apache.tapestry.*;
> import org.apache.tapestry.html.*;
> 
> public class Home extends BasePage {
>         public IActionListener getOkListener() {
>                 return new IActionListener() {
>                         public void actionTriggered( IComponent
> component, IRequestCycle cycle) {
>                                 cycle.activate("Result");
>                         }
>                 };
>         }
> }
> 
> thanks,
> Alex
> 
>

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