There's a tiny bit of magic going on. A listener is really an object that
implements the IActionListener interface. Really old versions of Tapesty
required that you create an getter method on your page and create a inner
class that implements the interface. That was a whole lot of "plumbing"
code, around the little tiny bit of application specific code.
What Tapestry does (this is in the docs) is scan your page class for
"listener methods" and for each one, an instance of IActionListener is
created that uses reflection to invoke your method.. Listener methods are
public, take a single IRequestCycle parameter, and return void. So, your
page has a property, "listeners", that is a kind of map of these methods,
and the "listeners" property has a nested property for each listener method.
So an expression, "listeners.formSubmit" maps to
public void formSubmit(IRequestCycle cycle)
on your class.
----- Original Message -----
From: "Phil" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 08, 2003 6:03 AM
Subject: [Tapestry-developer] listeners.formSubmit ?
> in some of the samples in the page specification, there is a listeners
> expression such as "listeners.formSubmit".
> As I look into the code, basically the listener is the class defined in
the
> page specification (see below page specification).
> So the listener in this case is the class: "EnquiryPage".
>
> Here are my questions:
> 1) Actually I'm not very sure what is the real listener class and how to
> know it?
> 2) Besides this, can I have multile listener class? (I thought, page
> specification class only allows 1 class)
> 3)When will the listener be invoked?
>
> Hope someone can share his/her experience.
>
> thanks,
> Phil
>
>
> =====================================
> <page-specification class="EnquiryPage">
>
> <component id="enquiryForm" type="Form">
> <binding name="listener" expression="listeners.formSubmit"/>
> </component>
>
> <component id="contactRepCheckbox" type="Checkbox">
> <binding name="selected" expression="contactRep"/>
> <binding name="disabled" expression="staff"/>
> </component>
>
> </page-specification>
> ========================================
>
> Service provided by MaGlobe Prepaid Worldwide Internet Access (visit
www.MaGlobe.com)
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> Tapestry-developer mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/tapestry-developer
>
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer