MicroStrategy ONE

Selecting the Template to be used for Page Execution

The template is the framework that defines the content for a page. After data has been collected from MicroStrategy Intelligence Server, the Controller returns the name of the template file to be used for displaying the data. Each page used by the application is associated with one or more templates, and each template is made up of page sections that provide the content for the various parts of the page. Both the template itself and the files that provide the content for the page sections are JSP or ASP.NET files. When a page has multiple templates, each one is associated with a different page status. For example, one template is used when the page is waiting for a request to be processed, another during processing, and yet another when the page is displaying results. A template that has no status is considered to be the default template for that page, and it is used when there is no specific template for the current status.

Click on any box in the diagram to see a detailed explanation of that step in page execution. Click here to return to the Overview of Page Execution.

The Controller selects the template file to be used based on the status of the page. The servlet or ASP.NET file reads the template file name from the Controller and uses it to display data to the user.

Customization

Customizing the template file used to display data to the user requires both customization of an XML parameter file and JSP or ASP.NET programming.  To change which template is associated with the target page, you simply modify the value of the status attribute in the <template> child element of the target <page> element in the Page Configuration file, pageConfig.xml

Copy
<pagedesc="Report Writing Documents" desc-id="" feature-id="" login-required="true" name="rwd" persist-mode="8" track="true">
  ...
  <templates>
    <templateXMLmerge_id="1" error-title-id="mstrWeb.921"status="com.microstrategy.web.beans.EnumRequestStatus.WebBeanRequestProcessing">
    ...
     </template>
    <templateXMLmerge_id="3" error-title-id="mstrWeb.921" iframe="true" show-wait="false"status="com.microstrategy.web.beans.EnumRequestStatus.WebBeanRequestWaitingForUserInput">
   ...

To modify the actual template that will be used to display the data on the target page, you must create or change the JSP or ASP.NET template file itself. The code snippet below is part of the MstrWeb.aspx template file.

Copy
<%--
 The metaContentType tag takes care of rendering the "META" HTML tag information
 for the page, according to what specified on the Locales configuration file, depending
 on the language the user has requested. For example, for english, the definition of this tag:
 <web:metaContentType runat="server"/>
 will render HTML content as: <META http-equiv="Content-Type" content="text/html; charset=UTF-8" />
--%>
<web:metaContentType runat="server"/>
<%--
  JSPTag tag will be removed from the ASPx page when this page is converted from JSP
  The contents of the ASPTag tag will replace the JSP ones.
--%>
<title><web:beanValue runat="server" mproperty="title" encode="true"/>. MicroStrategy 8</title>
<%--
 Display the links section of the template as specified in pageConfig.xml (i.e. Login_Links.jsp)
 <jsp:include page="[a page section]" />
--%>
<web:include runat="server" flush="true" id="webinclude1" />
<style type="text/css">
.mstr, .mstr input, .mstr select, .mstr textarea {
<web:ifFeature runat="server" name="fontFamilyOption" type="preference" value="1"><web:mthen runat="server">
font-family: <web:beanValue runat="server" mproperty="fontName"/>;
</web:mthen></web:ifFeature>
<web:ifFeature runat="server" name="fontSizeOption" type="preference" value="1"><web:mthen runat="server">
font-size: <web:beanValue runat="server" mproperty="fontSize"/>pt;
</web:mthen></web:ifFeature>
}
</style>

When you create a custom ASP.NET template file, such as a copy of mstrweb.aspx, you must also copy the .vb code-behind file, a copy of mstrweb.aspx.vb  in this case.

ClosedClick here to see important classes and files used by the application at this step of page execution.

The following classes play important roles, at the application level, during this stage of page execution:

  • TemplateInfo: A page can have one or more templates, each of which is associated with a different status of the page. The template is the physical file (JSP or ASP.NET) to which the servlet will forward execution after the request is processed. 

  • SectionInfo: A template is divided into several sections: header, toolbar, content, footer and error. Each section is rendered with a different physical file (JSP or ASP.NET). The SectionInfo defines which physical file will be used to display each section.

Problem solving during customization

Errors are not generally encountered during the selection of the template. However, if you made errors, such as misspellings or incorrect syntax, when you modified the template node in the Page Configuration file, the application will throw an error. Error information will not be logged, but you will be redirected to the Error page and the stack trace of the error will be written to the HTML source on the Error page. All of the available information can be used to gain insight into the error. The stack trace and debugging information can be viewed in the HTML source for the page. See Error Handling for a more detailed discussion of error handling in MicroStrategy Web products.

It is a good practice to validate XML configuration and layout definition files before starting MicroStrategy Web. Eclipse and other IDEs provide a way to validate these files.

Next step in page execution

After the template has been selected, the next step in page execution is arranging the content to be displayed on the page.

See also