All portlets are wrapped in an HTML template to display in a Web browser. Other template types are available only when you are creating that type of portlet; that is, you can access JSP templates only when you are creating a JSP portlet.
When you create an HTML template that includes a table, the code must include the <OPContent> tag in each HTML table row description. The <OPContent> creates cells in which to add content. The <OPContent> tag uses this syntax:
<OPContent id="id_number" name="position_descriptor_name"/>
id_number – a sequential number, starting with 0 (zero), which identifies table cells. The id_number of the first <OPContent> tag must be id=0 and subsequent <OPContent> tags must be sequential.
position_descriptor_name – a descriptive name that specifies the cell’s position within the table.
The id_number and position_descriptor_name for each <OPContent> tag must be unique. Only content that would normally occur between the opening and closing <body> tags should be included in the HTML template.
This code represents a template that looks like Figure 8-1. The code between the <STYLE> uses the Cascading Style Sheet (CSS) classes that define the formatting of data-capable elements.
<STYLE TYPE="text/css"> .gridRowHeader{background:#DEDEB9;padding:4px;padding-bottom:0px;border:1px solid #FFF;font-size:13px;font-family:verdana;color:#336699;font-weight:bold;} .gridRowA{background:#EEF9FF;padding:4px;padding-bottom:0px;border:1px solid #FFF;font-size:13px;fontfamily:verdana;} .gridRowB{background:#FFFFFF;padding:4px;padding-bottom:0px;border:1px solid #FFF;font-size:13px;font-family:verdana;}</STYLE> <table width="100%" border="1" cellspacing="0" cellpadding="0"> <tr align="center" valign="middle"> <td height="10" colspan="2"><OPContent id="0" name="Top Content"/></td></tr> <tr align="center" valign="middle"> <td height="10" width="50%"><OPContent id="1" name="Middle Left Content"/></td> <td height="10" width="50%"><OPContent id="2" name="Middle Right Content"/> </td></tr> <tr align="center" valign="middle"> <td height="10" colspan="2"><OPContent id="3" name="Bottom Content"/> </td></tr></table>
Figure 8-1: HTML example template
Copyright © 2004. Sybase Inc. All rights reserved. |
![]() |