6. Hooks and Listeners
You can create custom hooks or listeners and attach it to defined view. Using this elements, you can connect defined in xml view to JAVA code.
6.1. hooks
Hooks are methods that will be executed every time when request to server is send.
6.1.1. view hook structure
Hooks have to be grouped in tag:
<hooks> // HOOK DEFINITIONS </hooks>
Every hook has structure:
<hookType class="className" method="beanMethod" />
Where:
- hookType - is type of hook
- className - class (path + name) which contains hook method
- beanMethod - name of hook method that should be executed
6.1.1. view hook types
hook type |
description |
---|---|
|
This hook is executed before view state initialization |
|
This hook is executed after initialization, but before event execution |
|
This is most common used hook type. This hook is executed after event execution, just before response is send to clients browser |
For more informations about hooks see 'view hooks section'.
6.2. listeners
Listeners are methods that will be executed when specified event is fired. Every listener has structure:
<listener event="eventname" class="className" method="beanMethod" />
Where:
- eventname - name of event on which this lisiner is waiting
- className - class (path + name) which contains listener method
- beanMethod - name of listener method that should be executed when event is fired
For more informations about listeners see 'view listeners section'.