Reputation: 5671
In my application I use a List<String>
as model for a select box. Each of the option strings contains a line break at the end.
The options are displayed fine, but it seems that Tapestry strips the line breaks before rendering the options, and then on submit it is unable to match the stripped string against the list of options, which still contains the line breaks.
For this reason my select box always comes up with the blank option selected, although the property already has a non-null value.
Upvotes: 0
Views: 2016
Reputation: 27994
You have not provided a model
parameter so tapestry has no way of knowing the available values. The model must be a SelectModel
instance. There's a few options for creating a SelectModel
.
create(List<?> objects, String labelProperty)
to create a SelectModel from a List using a bean property as the label for each.SelectModel
yourself.http://tapestry.apache.org/5.3.7/apidocs/org/apache/tapestry5/corelib/components/Select.html http://tapestry.apache.org/5.3.7/apidocs/org/apache/tapestry5/SelectModel.html http://tapestry.apache.org/5.3.7/apidocs/org/apache/tapestry5/services/SelectModelFactory.html http://tapestry.apache.org/typecoercer-service.html
Upvotes: 1