Robert Zeigler wrote:
> 1) If you're using action links, then
> onXML won't work. The proper "magic method" naming is:
> on<eventname>[from<componentname>]
> 
> as:
> onActionFromXml, and so forth.
> 
> If you want:
> onXML() {} then you need to use an event link with the event name of xml.

Thanks, I hadn't noticed EventLink until now!

> I'm not /quite/ sure what you mean by "doesn't pass the parameters as
> expected".

As in, "the page context params do not appear in the
ActionLink-generated URI". I still see this with an EventLink; on a page
with URI

.../view/p1234

an EventLink like this

<a href="#" t:type="eventlink" t:event="xml">XML</a>

generates a link with this URI:

.../view:xml

i.e. the context of the page containing the link is not propagated to
the URI of the event link. Is this expected? From your discussion of the
two contexts (below), I would expect the page activation context to be
merged with the link context (which I'm not specifying).

> There are two different "contexts" at play when you're using an event
> link or an action link: the link context, and the page's activation
> context.  In an action link, at least, the page's activation context
> winds up in a query parameter like: t:ac=<contextvalues>.  Then the
> context from the action or event link is also used, and /these/ values
> are what are passed to the event handler method.  So as long as your
> "onPassivate" correctly returns the current activation context state,
> then your onActivate handler should be called for event and action
> links, and then the only issue left is to handle your events however you
> want to handle them.

I wasn't explicitly implementing onPassivate(). Interpreting what you
say above, if I add

public EventContext onPassivate(EventContext context) {
  return context;
}

then I get an EventLink URI like this:

.../view:xml?t:ac=org.apache.tapestry5.internal.structure.ComponentPageElementImpl$$14$004075ecf6

Bookmarkable, but not something that can be programmatically accessed...
and it shows a bit too much of the servlet internals for my taste!

Andy

-- 
Dr Andy Buckley
Institute for Particle Physics Phenomenology
Durham University
0191 3343798 | 0191 3732613 | www.insectnation.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to