blob: c3ca2498b22f48bab4a7ae4f02db5eb01af71dd9 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="../../../book.css" type="text/css">
<title>Adding a Converter</title>
</head>
<body>
<div class="section" lang="en">
<div class="titlepage">
<div>
<div>
<h1 class="Head" style="clear: both"><a name="add_converter"></a>Adding
a Converter</h1>
</div>
</div>
<div></div>
</div>
<p>You can add a converter to your Web application. A converter is
used in the conversion model, each component can be associated with
server-side model object data. The component data can have two views,
model and presentation, and the data can be converted between the model
view and the presentation view. For example, use a converter to have the
output be object to string and the input be string to object.</p>
<p><span class="strong">To add a converter:</span></p>
<div class="orderedlist">
<ol type="1">
<li>
<p>Select <span class="strong"> faces-config.xml</span> in the <span
class="strong">Project Explorer</span> of the <span class="strong">J2EE</span> perspective.</p>
<p>The JSF Application Configuration editor opens.</p>
</li>
<li>
<p>Select the <span class="strong">Component </span>tab of the
editor.</p>
</li>
<li>
<p>Expand the <span class="strong">Converters</span> section.</p>
<p>A list of defined converters displays..</p>
</li>
<li>
<p>Click <span class="strong">Add</span>.</p>
<p>A new converter is added to the Converters list <span class="emphasis"><em>x</em></span>.</p>
</li>
<li>
<p>(Optional) Change the default converter name to a unique,
descriptive name in the <span class="strong">Display name</span> field
of the <span class="strong">General </span>section.</p>
</li>
<li>
<p>(Optional) Type a description in the <span class="strong">Description</span>
field.</p>
</li>
<li>
<p>Do one of the following:</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>Type an ID in the <span class="strong">Converter ID</span>
field.</p>
</li>
<li>
<p>Select a Converter for Class:</p>
<div class="orderedlist">
<ol type="a">
<li>
<p>Click the <span class="strong">Browse </span>button adjacent
to the <span class="strong">Converter for Class</span> field.</p>
<p>The Select Type dialog box appears.</p>
</li>
<li>
<p>Select the matching type that you want to use and click<span
class="strong"> OK</span>.</p>
</li>
</ol>
</div>
<p></p>
</li>
</ul>
</div>
<p></p>
</li>
<li>
<p>Click <span class="strong">Browse</span> and select a<span
class="strong"> Converter Class</span>.</p>
</li>
<li>
<p>Click <span class="strong">Add </span>in the <span
class="strong">Attributes </span>section to add an attribute.</p>
</li>
<li>
<p>Click <span class="strong">Add </span>in the <span
class="strong">Properties </span>section to add a property.</p>
</li>
</ol>
</div>
<p></p>
<br>
<img src="../../../images/ngrelc.png" alt="Related concepts" border="0">
<p><br>
</p>
<p><img src="../../../images/ngrelr.png" alt="Related reference"
border="0"></p>
<p><br>
</p>
<p>
<a href="../use_facesconfig_editor.html">Faces Config Editor</a><br></p>
<p><img src="../../../images/ngrelt.png" alt="Related tasks" border="0">
</p>
<p><a
href="../../gettingstarted/tutorial/JSFTools_tutorial.html">Tutorial</a></p>
</div>
</body>
</html>