Home > Contents > Index >
fragment:include
Provides logical blocks of presentation code to be used in the design layout of a template.
Syntax
<fragment:include name="fragmentName" [index="index in iterable fragments"] [editable="true|false"] [styles="styles"] [title="title"] [emptytext="emptytext"] [buttons="buttons"] />Parameters
name (required)
- Name of the fragment as referenced in the controller.
For example: in the controller, if the fragment is set into the model as: models.put("myfragment", fragment), then it will be de-referenced in the view as: <fragment:include name="myfragment" />
index (optional)
- 0-based index of the fragment to be de-referenced. This may be necessary while working with Iterable fragments.
If the fragment reference contains a single (non-iterable) fragment, then only index '0' may be dereferenced - all other indices will return null.
For example: if "myfragment" is an iterable fragment of size 3, then: <fragment:include name="myfragment" /> will render the 0-th element from the list.
<fragment:include name="myfragment" index="1" /> will render the 1-st element from the list.
But if "myfragment" is a non-iterable fragment, then: <fragment:include name="myfragment" > will render the fragment <fragment:include name="myfragment" index="1" /> will throw an exceptioneditable (optional)
- View override for editable fragments.
This override is necessary when editable fragments created in the controller needs to be rendered in read-only mode. For example: if an Editable Fragment is created in the Controller as: models.put("myEditableFragment", newEditableTemplateFragment()...) then the following will render the fragment in **edit** mode in the view: <fragment:include name="myEditableFragment" /> but the following will render the fragment in **read-only** mode in the view: <fragment:include name="myEditableFragment" editable="false" /> Note: This flag cannot be used to render a read-only fragment in editable mode. In other words, the following will not make the fragment editable in the view: models.put("myReadOnlyFragment", newTemplateFragment()...) <fragment:include name="myReadOnlyFragment" editable="true" />styles (optional)
- View override for editable fragments for additional css classes to add to the slot, whenever CSS rules need to be adjusted.
title (optional)
- View override for the slot title rendered in slot overlays.
emptyText (optional)
- View override for the text to be rendered inside empty slots.
buttons (optional)
- View override for the buttons to show in the mini bar for edit operations on the slot.
Description
Fragment tags provide logical blocks of presentation code to be used in the design layout of a template.
Home > Contents > Index > ![]()
Oracle JSP Tag Reference
Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.