|
|
It sounds like your logout listener method is in your page class, but
the directlink in question resides within a component, no? That would
explain why you need to reference the ListenerMap of the page (returned
via getPage()).
Paul
Todd O'Bryan wrote:
The example you give works so long as I put page in front of it, i.e.
listener="ognl:page.listeners.getListener('logout')"
However, if I try
listener="ognl:page.listeners.getListener(listItem.methodName)"
I get an exception.
Todd
On Nov 21, 2004, at 11:33 PM, Paul Ferraro wrote:
Try this:
<a jwcid="@DirectLink" href="#"
listener="ognl:listeners.getListener('logout')">Logout</a>
AbstractComponent.getListeners() returns a
org.apache.tapestry.listener.ListenerMap that exposes a
getListener(String) method.
Paul
Todd O'Bryan wrote:
I have now. It doesn't seem to work. It may be more complicated than
I first mentioned, though, because I'm trying to do this in a
component, and I have switched to a DirectLink as Jamie suggested:
If my listener method is named "logout" (one of them is), then
<a jwcid="@DirectLink" href="#"
listener="ognl:page.listeners.logout">Logout</a>
works fine.
If, however, I try to give 'logout' as a String, I have no luck
triggering the second round of evaluation necessary to get it to
resolve. The method suggested by Shing doesn't work even if I give
the name of the method as a literal String, and doesn't work if I
try to evaluate it either.
listener="ognl:page.getListeners('logout')"
listener="ognl:page.getListeners(listItem.methodName)"
both fail.
Any other ideas?
Todd
On Nov 21, 2004, at 7:46 AM, Shing Hing Man wrote:
Have you tried the following ?
listener='ognl:getListeners(listItem.methodName)'
Shing
--- Todd O'Bryan <toddobryan@xxxxxxx> wrote:
Suppose I have a bunch of ActionLinks encoded in a
List, each with the
name of a method I'd like to call. I'd like to
display each link and
bind its listener attribute to the appropriate
method. I can't do:
<a jwcid="@ActionLink"
listener="ognl:'listeners.'+listItem.methodName">
... </a>
because the listener evaluates to a String, not a
method. Is there a
way to get OGNL to do a second round of evaluation
so that my String
"listeners.myMethod" gets resolved to the
appropriate method?
If not, is there some way to set an instance
variable in listItem to be
the actual listener method instead of just its name?
TIA,
Todd
---------------------------------------------------------------------
To unsubscribe, e-mail:
tapestry-user-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail:
tapestry-user-help@xxxxxxxxxxxxxxxxxx
=====
Home page :
http://uk.geocities.com/matmsh/index.html
___________________________________________________________
Win a castle for NYE with your mates and Yahoo! Messenger
http://uk.messenger.yahoo.com
---------------------------------------------------------------------
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
---------------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: tapestry-user-help@xxxxxxxxxxxxxxxxxx
|
|