Xebra Taglib Page

About | Installation | Documentation | Tutorials | Frequently Asked Questions


The page libraries consists of the core tags needed for page configuration and composition. The Tags are:

Tag Description
<page:controller class="..." create="..." />

Defines the controller which should be used for the xeb page. The optional 'create' attribute defines the name of the creation procedure. 'default_create' is used by default.

<page:declare_region id="..." />

Declares a region at the specific point in the xeb page where including pages can add specific html code.

<page:define_region id="...">

Can only be used inside a page-include tag. Will insert the content into the templates regions (with the same id). See page-include.

<page:include id="..." />

Includes an other xeb page. If the included page has declare-region tags they have to be implemented with define-region tags.


If used the page is not transformed to a servlet. This tag shouldn't be necessary to use unless the page has to be temporary disabled.


This example shows the workings of the template framework. It consists of a master page which acts as a template and three different types of usage of this template.


<page:controller class="DEFAULT_CONTROLLER" create="make"/>
<page:declare_region id="greeting" />
<page:declare_region id="form" />

The master page is "deferred", since there are page:declare_region tags. The translator detects the undefined regions and doesn't generate a servlet from this xeb file. Note that we specified the creation procedure via 'create' as 'make' and therefore overwrote the default procedure 'default_create'.


<page:include template="master">
<page:define_region id="greeting">
Hello, I'm Slave 1
<page:define_region id="form">
Other region

slave1.xeb uses master.xeb as a template and includes it via the page-include tag. Since master.xeb declares two regions, slave1 defines them. The content of the define-region tags are inserted at the locations of the respective declare-region tags of the template. From this xeb file a servlet is generated. Additionally since it's not declaring any controller all controller calls are redirected to the ones in the template.


<page:include template="master"
<page:define_region id="form">
Other region 2

Templates can also be just imported partially. In slave2.xeb just the "form"-part of the template is implemented. This means that slave2.xeb is itself a template and will not be translated to a servlet.


<page:include template="slave2.xeb">
<page:define_region id="greetings">

This last example uses slave2.xeb as a template, which has one remaining region to implement: "greetings. The controller is still inherited from master.xeb, that is, controllers are transitive.

With these techniques we would be able to minimize duplicated code and hence errors in the xeb files, which are difficult to debug.