netui-template:includeSection Tag

<netui-template:includeSection> Tag

This tag is used within a template page to define placeholders for HTML content.

Syntax

<netui-template:includeSection
    [defaultPage="string_defaultPage"]
    name="string_name" />

Description

This tag is used within a template page to define placeholders for HTML content. Each placeholder must have a unique name identifying it. Different content pages adopt the template page, set properties on its placeholders (using the <netui-template:section> tag), and render the completed HTML in the browser.

For example, a template page can use the <netui-template:includeSection> tag to define a content placeholder.

In the template JSP page...

      <table>
          <tr>
              <td colspan="3">
                  <netui-template:includeSection name="tableHeader"/>
              </td>
          </tr>

Then a content page can set HTML content in the placeholder using the <netui-template:section> tag.

In a content JSP page...

    <netui-template:section name="tableHeader">
        <h1>HEADER TEXT</h1>
    </netui-template:section>

The HTML rendered in the browser will appear as follows.

      <table>
          <tr>
              <td colspan="3">
                  <h1>HEADER TEXT</h1>
              </td>
          </tr>

If the content page does not define content to be placed in the placeholder, then the defaultPage attribute will be used. The defaultPage attribute points at a stand-alone JSP page. The entire contents of the page will be placed in the placeholder, after any Java elements, such as scriptlets have been resolved.

Attributes

defaultPageA default JSP page to provide content for the placeholder if the content page fails to define the content.
 
RequiredSupports runtime expression evaluationData bindable
NoYesNo

nameThe name of the section. This name must be unique within the template page.
 
RequiredSupports runtime expression evaluationData bindable
YesNoNo

Sample

In this sample a <netui-template:includeSection> tag defines a place holder for a table row
    <tr>
        <netui-template:includeSection name="rowPlaceholder" defaultPage="defaultPage.jsp"/>
    </tr>

If there is no content page that sets content into this placeholder using a <netui-template:section> tag, then the entire contents of the defaultPage.jsp will be used. Assume that the defaultPage.jsp appears as follows.

    <p><%= 1 + 1 %></p>
Then the HTML rendered in the browser will appear as follows. Note that the Java scriptlet <%= 1 + 1 %> has been resolved to the value 2.
    <tr>
        <p>2</p>
    </tr>

Code Sample

[BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui_template/template/template.jsp [BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui_template/template/defaultPage.jsp [BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui_template/template/templateUsingJSP.jsp

Related Topics

<netui-template:...> Tags Sample

<netui-template:attribute> Tag

<netui-template:section> Tag

<netui-template:setAttribute> Tag

<netui-template:template> Tag

<netui-template:visible> Tag