Clone wiki

AspectFaces / 6.Layouts

Layouts are another independent aspect isolated in Aspect Faces framework. These templates are used for organizing generated UI widgets to produce properly formed page snipped. Layouts are usually simple HTML templates enhanced by a bunch of Aspect Faces tags declaring way of component injection. If there is no layout then widgets are concatenated next to each other.

Layout templates are usually located in /WEB-INF/af/profile/layouts/ directory and there are supported tags and expressions:

Tag or expression Description
$af:next$ Next generated widget. These expressions are replaced by produced source code.
$af:field$ These expressions are used in special layouts for concrete classes because they need the specific field to be located in a particular place. Then the expressions may be: $af:firstName$, or $af:email$.
<af:iteration-part maxOccurs="100"/> If you want to produce a table or declare another layout if the repeated structure, then you can you this tag. Everything inside of this tag is rendered until there are some snippets left. Inside of this tag may be more than one $af:next$ expression.

In af:ui tag you select the layout to be used by layout attribute where the value is valid file name located in layouts directory.

Example of two column layout

<table>
    <af:iteration-part maxOccurs="100">
        <tr>
            <td>$af:next$</td>
            <td>$af:next$</td>
        </tr>
    </af:iteration-part>
</table>

Example of class-specific layout

<table>
    <tr>
        <td>$af:firstName$</td>
        <td>$af:lastName$</td>
    </tr>
    <af:iteration-part maxOccurs="100">
        <tr>
            <td>$af:next$</td>
            <td>$af:next$</td>
        </tr>
    </af:iteration-part>
</table>

<div class="notes">$af:notes$</div>

Updated