202 lines
9.9 KiB
HTML
202 lines
9.9 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="reference" />
|
|
<meta name="DC.Title" content="Example: Using RecordListRowData" />
|
|
<meta name="abstract" content="" />
|
|
<meta name="description" content="" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="recdtout" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>Example: Using RecordListRowData</title>
|
|
</head>
|
|
<body id="recdtout"><a name="recdtout"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example: Using RecordListRowData</h1>
|
|
<div><p></p>
|
|
<div class="section"><p>This example has three parts:</p>
|
|
</div>
|
|
<div class="section"><ul><li> <a href="#recdtout__javarecordlistrowdata">Java™ source</a> that shows how the RecordListRowData
|
|
class works</li>
|
|
<li> <a href="#recdtout__htmlrecordlistrowdata">HTML source</a> generated
|
|
from the Java source by the using <a href="tablconv.htm#tablconv">HTMLTableConverter</a></li>
|
|
<li> <a href="#recdtout__displayrecordlistrowdata">How a browser displays
|
|
the generated HTML</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="section"><div class="p"><strong><span class="synph" id="recdtout__javarecordlistrowdata"><a name="recdtout__javarecordlistrowdata"><!-- --></a><span class="kwd"></span></span>Java source
|
|
that shows how the RecordListRowData class works</strong> <pre> // Create a server object.
|
|
AS400 mySystem = new AS400 ("mySystem.myComp.com", "UserId", "Password");
|
|
|
|
// Get the path name for the file.
|
|
QSYSObjectPathName file = new QSYSObjectPathName(myLibrary, myFile, "%first%", "mbr");
|
|
String ifspath = file.getPath();
|
|
|
|
// Create a file object that represents the file.
|
|
SequentialFile sf = new SequentialFile(mySystem, ifspath);
|
|
|
|
// Retrieve the record format from the file.
|
|
AS400FileRecordDescription recordDescription = new AS400FileRecordDescription(mySystem, ifspath);
|
|
RecordFormat recordFormat = recordDescription.retrieveRecordFormat()[0];
|
|
|
|
// Set the record format for the file.
|
|
sf.setRecordFormat(recordFormat);
|
|
|
|
// Get the records in the file.
|
|
Record[] records = sf.readAll();
|
|
|
|
// Create a RecordListRowData object and add the records.
|
|
RecordListRowData rowData = new RecordListRowData(recordFormat);
|
|
|
|
for (int i=0; i < records.length; i++)
|
|
{
|
|
rowData.addRow(records[i]);
|
|
}
|
|
|
|
// Create an HTML converter object and convert the rowData to HTML.
|
|
HTMLTableConverter conv = new HTMLTableConverter();
|
|
conv.setMaximumTableSize(3);
|
|
HTMLTable[] html = conv.convertToTables(rowData);
|
|
|
|
// Display the first HTML table generated by the converter.
|
|
System.out.println(html[0]);</pre>
|
|
<strong><span class="synph" id="recdtout__htmlrecordlistrowdata"><a name="recdtout__htmlrecordlistrowdata"><!-- --></a><span class="kwd"></span></span>HTML
|
|
source generated from the Java source by the using HTMLTableConverter</strong></div>
|
|
</div>
|
|
<div class="section"><p>Using the <a href="tablconv.htm#tablconv">HTMLTableConverter</a> class
|
|
in the Java source example above generates the following HTML
|
|
code.</p>
|
|
</div>
|
|
<div class="section"><div class="p"><pre><table>
|
|
<tr>
|
|
<th>CNUM</th>
|
|
<th>LNAM</th>
|
|
<th>INIT</th>
|
|
<th>STR</th>
|
|
<th>CTY</th>
|
|
<th>STATE</th>
|
|
<th>ZIP</th>
|
|
<th>CTLMT</th>
|
|
<th>CHGCOD</th>
|
|
<th>BDUE</th>
|
|
<th>CTDUE</th>
|
|
</tr>
|
|
<tr>
|
|
<td>938472</td>
|
|
<td>Henning </td>
|
|
<td>G K</td>
|
|
<td>4859 Elm Ave </td>
|
|
<td>Dallas</td>
|
|
<td>TX</td>
|
|
<td align="right">75217</td>
|
|
<td align="right">5000</td>
|
|
<td align="right">3</td>
|
|
<td align="right">37.00</td>
|
|
<td align="right">0.00</td>
|
|
</tr>
|
|
<tr>
|
|
<td>839283</td>
|
|
<td>Jones </td>
|
|
<td>B D</td>
|
|
<td>21B NW 135 St</td>
|
|
<td>Clay </td>
|
|
<td>NY</td>
|
|
<td align="right">13041</td>
|
|
<td align="right">400</td>
|
|
<td align="right">1</td>
|
|
<td align="right">100.00</td>
|
|
<td align="right">0.00</td>
|
|
</tr>
|
|
<tr>
|
|
<td>392859</td>
|
|
<td>Vine </td>
|
|
<td>S S</td>
|
|
<td>PO Box 79 </td>
|
|
<td>Broton</td>
|
|
<td>VT</td>
|
|
<td align="right">5046</td>
|
|
<td align="right">700</td>
|
|
<td align="right">1</td>
|
|
<td align="right">439.00</td>
|
|
<td align="right">0.00</td>
|
|
</tr>
|
|
</table></pre>
|
|
<strong><span class="synph" id="recdtout__displayrecordlistrowdata"><a name="recdtout__displayrecordlistrowdata"><!-- --></a><span class="kwd"></span></span>How
|
|
a browser displays the generated HTML</strong></div>
|
|
</div>
|
|
<div class="section"><p>The following table shows how the HTML source code looks when
|
|
viewed in a browser.</p>
|
|
</div>
|
|
<div class="section"><div class="p">
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="void" border="0" rules="none"><thead align="left"><tr><th valign="top" width="5.769230769230769%" id="d0e94">CNUM</th>
|
|
<th valign="top" width="8.241758241758241%" id="d0e96">LNAM</th>
|
|
<th valign="top" width="5.21978021978022%" id="d0e98">INIT</th>
|
|
<th valign="top" width="16.208791208791208%" id="d0e100">STR</th>
|
|
<th valign="top" width="6.868131868131869%" id="d0e102">CTY</th>
|
|
<th valign="top" width="6.868131868131869%" id="d0e104">STATE</th>
|
|
<th valign="top" width="7.6923076923076925%" id="d0e106">ZIP</th>
|
|
<th align="right" valign="top" width="12.637362637362637%" id="d0e108">CTLMT</th>
|
|
<th valign="top" width="10.164835164835164%" id="d0e110">CHGCOD</th>
|
|
<th align="right" valign="top" width="9.89010989010989%" id="d0e112">BDUE</th>
|
|
<th align="right" valign="top" width="10.43956043956044%" id="d0e114">CTDUE</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td valign="top" width="5.769230769230769%" headers="d0e94 ">938472</td>
|
|
<td valign="top" width="8.241758241758241%" headers="d0e96 ">Henning</td>
|
|
<td valign="top" width="5.21978021978022%" headers="d0e98 ">G K</td>
|
|
<td valign="top" width="16.208791208791208%" headers="d0e100 ">4859 Elm Ave</td>
|
|
<td align="left" valign="top" width="6.868131868131869%" headers="d0e102 ">Dallas</td>
|
|
<td align="left" valign="top" width="6.868131868131869%" headers="d0e104 ">TX</td>
|
|
<td align="left" valign="top" width="7.6923076923076925%" headers="d0e106 ">75217</td>
|
|
<td align="right" valign="top" width="12.637362637362637%" headers="d0e108 ">5000</td>
|
|
<td align="center" valign="top" width="10.164835164835164%" headers="d0e110 ">3</td>
|
|
<td align="right" valign="top" width="9.89010989010989%" headers="d0e112 ">37.00</td>
|
|
<td align="right" valign="top" width="10.43956043956044%" headers="d0e114 ">0.00</td>
|
|
</tr>
|
|
<tr><td valign="top" width="5.769230769230769%" headers="d0e94 ">839283</td>
|
|
<td valign="top" width="8.241758241758241%" headers="d0e96 ">Jones</td>
|
|
<td valign="top" width="5.21978021978022%" headers="d0e98 ">B D</td>
|
|
<td valign="top" width="16.208791208791208%" headers="d0e100 ">21B NW 135 St</td>
|
|
<td align="left" valign="top" width="6.868131868131869%" headers="d0e102 ">Clay</td>
|
|
<td valign="top" width="6.868131868131869%" headers="d0e104 ">NY</td>
|
|
<td align="left" valign="top" width="7.6923076923076925%" headers="d0e106 ">13041</td>
|
|
<td align="right" valign="top" width="12.637362637362637%" headers="d0e108 ">400</td>
|
|
<td align="center" valign="top" width="10.164835164835164%" headers="d0e110 ">1</td>
|
|
<td align="right" valign="top" width="9.89010989010989%" headers="d0e112 ">100.00</td>
|
|
<td align="right" valign="top" width="10.43956043956044%" headers="d0e114 ">0.00</td>
|
|
</tr>
|
|
<tr><td valign="top" width="5.769230769230769%" headers="d0e94 ">392859</td>
|
|
<td valign="top" width="8.241758241758241%" headers="d0e96 ">Vine</td>
|
|
<td valign="top" width="5.21978021978022%" headers="d0e98 ">S S</td>
|
|
<td valign="top" width="16.208791208791208%" headers="d0e100 ">PO Box 79</td>
|
|
<td align="left" valign="top" width="6.868131868131869%" headers="d0e102 ">Broton</td>
|
|
<td valign="top" width="6.868131868131869%" headers="d0e104 ">VT</td>
|
|
<td align="left" valign="top" width="7.6923076923076925%" headers="d0e106 ">5046</td>
|
|
<td align="right" valign="top" width="12.637362637362637%" headers="d0e108 ">700</td>
|
|
<td align="center" valign="top" width="10.164835164835164%" headers="d0e110 ">1</td>
|
|
<td align="right" valign="top" width="9.89010989010989%" headers="d0e112 ">439.00</td>
|
|
<td align="right" valign="top" width="10.43956043956044%" headers="d0e114 ">0.00</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html> |