Id Select

There are times when SelectModelFactory is too much, when you need only an id returned and not a whole object.
In this example we've created PersonIdSelectModel to give us control over the option value, which we set to the id.
We don't need a ValueEncoder because personId is a Long and Tapestry knows how to convert between Long and String.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- We need a doctype to allow us to use special characters like &nbsp;
We use a "strict" DTD to make IE follow the alignment rules. -->
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
<body class="container">
<h3>Id Select</h3>
There are times when SelectModelFactory is too much, when you need only an id returned and not a whole object.<br/>
In this example we've created PersonIdSelectModel to give us control over the option value, which we set to the id.<br/>
We don't need a ValueEncoder because personId is a Long and Tapestry knows how to convert between Long and String.
<div class="eg">
<t:form t:id="form" class="form-inline">
<div class="form-group">
Person:
<t:select model="personIdsModel" value="personId"/>
<t:submit/>
You chose personId: ${personId}
</div>
</t:form>
</div>
References:
<a href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/corelib/components/Select.html">Select</a>,
<a href="http://tapestry.apache.org/using-select-with-a-list.html">Using Select with a List</a>,
<a href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/SelectModel.html">SelectModel</a>,
<a href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/util/AbstractSelectModel.html">AbstractSelectModel</a>,
<a href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/ValueEncoder.html">ValueEncoder</a>,
<a href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/EventContext.html">EventContext</a>.<br/><br/>
<t:pagelink page="Index">Home</t:pagelink><br/><br/>
The source for IPersonFinderServiceLocal and @EJB is shown in the Session Beans and @EJB examples.<br/><br/>
<t:tabgroup>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/pages/examples/select/IdSelect.tml"/>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/pages/examples/select/IdSelect.java"/>
<t:sourcecodetab src="/web/src/main/resources/META-INF/assets/css/examples/select.css"/>
<t:sourcecodetab src="/web/src/main/java/jumpstart/web/models/examples/select/PersonIdSelectModel.java"/>
<t:sourcecodetab src="/business/src/main/java/jumpstart/business/domain/person/Person.java"/>
</t:tabgroup>
</body>
</html>