MicroStrategy ONE

Page template

The page template defines the overall layout of the different sections on a given page. A page is separated into a set of sub-pages or sections. These individual sections can be reused through separate files that are included at run time using the page template. The page template defines the layout of different sections on a page.

Most pages in the application use mstrWeb (JSP or ASP .NET file) as the page template. The following diagram shows an example of the sections defined in this template. The content section includes a large container bean, which in turn contains multiple component beans.

The links page section is not represented in the diagram below since it does not render any data on the page.

Refer to MicroStrategy Web page structure for additional information on the page structure with respect to the default page template.

The <template> nodes define the page templates to use for a particular page. In a <template> node, the file-name attribute defines the location of the file to use as page template, relative to the Web ASPx/asp folder (in a .NET environment) or the MicroStrategy folder (in a J2EE environment).

  • Example in a .NET environment: <template file-name="mstrWeb.aspx"/>.
  • Example in a J2EE environment: <template file-name="/jsp/mstrWeb.jsp"/>.

A single page can have multiple templates depending on the status of the page. For example, one template can be used for displaying relevant information when a page is in a processing state, and another template can be used for the same page when the request is successfully completed.

The template used is based on the status of the page. The status of the page is determined by the status of all the beans on the page. A page has a status of successful only when all beans on that page have a successful state. The page’s status is error if any one bean on that page is in error. The default template is used when other template statuses are not met.

Templates other than the default template can be invoked depending upon the status of an executing request. In a <template> node, the status attribute controls which page template is invoked based on the page's status. If the status attribute is included, its value can be set to any fully qualified value from the EnumRequestStatus interface defined in the API Reference. The possible values are available in the API reference. If the status attribute is not included or there is no status match, then the default template is used.

The <template> node contains the <page-sections> child node. This, in turn, contains multiple <page-section> nodes. Within a <page-section> node, the file-name attribute defines the location, relative to the Web ASPx/asp folder (in a .NET environment) or the MicroStrategy folder (in a J2EE environment), of the template file to use for that particular section.

  • Example in a .NET environment: <template file-name="Report_Content.ascx"/>.
  • Example in a J2EE environment: <template file-name="/jsp/Report_Content.jsp"/>.

Each <page-section> has a name. This name is the name used by the page template code to reference that section. Refer to Modifying the template for additional information on how to modify the page template's JSP or ASP code.

Code sample in J2EE architecture

The template file mstrWeb (JSP or ASP .NET file) defines how page sections are positioned with respect to each other. It is located in the MicroStrategy/jsp folder. A template’s file-name attribute defines which template file to use for laying out page sections. The template file refers to other files by their key name such as content, header, and so on.

The <page-section> tags define actual files to use for different sections. For example, /jsp/Report_Header.jsp.

<template file-name="/jsp/mstrWeb.jsp"/>

  <page-sections use-default="true"/>

    <page-section file-name="/jsp/Report_Path.jsp"  name="path"/>

    <page-section file-name="/jsp/Report_Content.jsp"  name="content"/>

  </page-sections>

  ...

</template>

Code sample in .NET architecture

The default template file in MicroStrategy Web products that use the .NET architecture is the combination of mstrWeb.aspx and mstrWeb.aspx.vb (The file is precompiled). It is located in the Web ASPx/asp folder.

  • mstrWeb.aspx defines the size, shape, and relative position of each specified page-section by a webinclude name. It retrieves the value of webinclude names from mstrWeb.aspx.vb.  

  • mstrWeb.aspx.vb contains a list of section names that are translated to generic webinclude names used by mstrWeb.aspx.

Changing the size, shape, or relative location of a page-section involves altering mstrWeb.aspx.

<template file-name="/asp/mstrWeb.aspx"/>

  <page-sections use-default="true"/>

    <page-section file-name="Report_Path.ascx" name="path"/>

    <page-section file-name="Report_Content.ascx" name="content"/>

    ...

  </page-sections>

  ...

</template>

If you create your own template file, it must be saved in the Web ASPx/asp folder (or a subfolder under it) for the Page Configuration file to use it in the Web application.

See also