Panels
Panels may be declared as children of a <panels> element using <panel> elements. Since panels may be nested to arbitrary depth, <panel> elements can contain <panel> child elements defining their subpanels.
A <panel> element requires the name attribute. The name must be unique under the <panel>'s siblings. For toplevel panels, the application uses this name like a resource path to instantiate it; for nested panels, the name is used by templates to include a template associated with a subpanel of the current panel. To reflect this, we use the convention to assign path-like names to toplevel panels and identifier-like names to subpanels.
The optional template attribute may be used to specify the associated template.
The optional super attribute can be used to specify a toplevel panel to extend. This is where inheritance comes into play. See the inheritance section for more on this.
Let's illustrate this by giving an example. Consider the following panel definitions:
<panel name="/base.page" template="/WEB-INF/jsp/layout/page.jsp"> <panel name="header" template="/WEB-INF/jsp/layout/header.jsp"/> <panel name="menu" template="/WEB-INF/jsp/layout/menu.jsp"/> <panel name="content"/> <panel name="footer" template="/WEB-INF/jsp/layout/footer.jsp"/> </panel> <panel name="/foo.page" super="/base.page"> <panel name="content" template="/WEB-INF/jsp/content/foo.jsp"/> </panel>
- Following our convention, we assigned path-like names to toplevel panels and identifier-like names to nested panels.
- The /base.page panel defines the subpanels header, menu, content and footer. The template attributes denote the associated templates.
- The /base.page's content panel does not specify a template, making /base.page abstract. That is, /base.page cannot be used as a dispatch target. Rather, it acts as a base definition, which may be extended by other panels.
- The /foo.page panel extends /base.page by specifying super="/base.page" and associates a template with its content subpanel, making it concrete. Thus, /foo.page can be used as a dispatch path by the controller.
-
The /WEB-INF/jsp/layout/page.jsp template instantiates
subpanels using the <panel> tag from the
custom tag library provided by the Calyxo Panels component
like this:
<jsp:root version="2.0" xmlns:panels="http://calyxo.odysseus.de/jsp/panels" xmlns:jsp="http://java.sun.com/JSP/Page"> ... <panels:panel name="header"/> ... <panels:panel name="menu"/> ... <panels:panel name="content"/> ... <panels:panel name="footer"/> ... </jsp:root>
To your application, concrete toplevel panels are of particular interest, because they can be instantiated by the controller. Technically spoken, you may dispatch to toplevel panels using their (path-like) names, just as you do with any resources.
Beside subpanels, a <panel> element may contain elements defining parameters and lists.


