Nhanld
Nhanld

Reputation:

How can I use InvokeListener in tapestry5?

How can I convert this code

<span jwcid="permissionInEachStep@InvokeListener"
      listener="listener:onEditPermissionInEachStep"/>

into tapestry5 or have a different way to invoke method?

Upvotes: 1

Views: 419

Answers (2)

Martin Dow
Martin Dow

Reputation: 5321

Adding to Chochos' answer... In Tapestry 5 you can hook into many phases in the rendering cycle. Here's a diagram of these phases, together with some explanation: http://tapestry.apache.org/tapestry5/guide/rendering.html

You can hook into these phases by either adding an appropriate annotation to the menthod you want Tapestry to call (@SetupRender, @AfterRender, etc. - see example in link above) or, as in Chochos' example, Tapestry will look for a method in your java page class matching the event name (you don't have to worry about case - Tapestry is case insensitive in this and most cases).

Upvotes: 1

Chochos
Chochos

Reputation: 5159

you can rename your method as setupRender() if you want it to be invoked just before it is rendered. If you need it to be invoked several times within a loop then I guess you'll have to define your own component with its setupRender method and include it in your page.

Upvotes: 1

Related Questions