tapestry-user@jakarta.apache.org
[Top] [All Lists]

Re: running example

Subject: Re: running example
From: Ron Piterman
Date: Thu, 31 Mar 2005 23:50:08 +0200
××××× 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 <glongman@xxxxxxxxx> 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@xxxxxxxxxxxxxxx > 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@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: tapestry-user-help@xxxxxxxxxxxxxxxxxx





---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: tapestry-user-help@xxxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>