suggestion box data conversion problem
jamesjmp Oct 1, 2007 12:42 PMhi,
I´m using suggestion box component. The values are fetched and showed properly in the suggestion box.
My problem is that after selecting one value, I have the following error:
value could not be converted to the expected type
This error matches the tag javax.faces.component.UIInput.CONVERSION so I´ve a conversion problem.
The code of the web page is this:
<s:decorate id="currencyIsoDecoration" template="layout/edit.xhtml">
<ui:define name="label">#{messages['CfgCurrency']}</ui:define>
<h:inputText id="currencyIso"
size="20"
maxlength="50"
required="true"
value="#{rstReportHome.instance.cfgCurrency.currencyIso}">
<a:support event="onblur" reRender="currencyIsoDecoration"/>
</h:inputText>
<rich:suggestionbox for="currencyIso" suggestionAction="#{suggestionBox.autocomplete}"
var="result" fetchValue="#{result}" >
<h:column>
<h:outputText value="#{result}" />
</h:column>
</rich:suggestionbox>
</s:decorate>And the autocomplete is this: (currencyList query returns a list of Strings)
@Name("suggestionBox")
public class SuggestionBox implements Serializable {
...
public List autocomplete(Object suggest) {
currencyIso = suggest.toString();
ArrayList result = new ArrayList();
Iterator<CfgCurrency> currencyIter = currencyList.iterator();
CfgCurrency ccy = null;
while ((currencyIter != null) && (currencyIter.hasNext()) ) {
ccy = currencyIter.next();
result.add(ccy.getCurrencyIso());
}
return result;
}CfgCurrency class has been generated by means of seam-gen as well as rstReportHome. This is the code:
@Name("rstReportHome")
public class RstReportHome extends EntityHome<RstReport> {
@In(create = true)
CfgCurrencyHome cfgCurrencyHome;
....
@Entity
@Table(name = "CFG_CURRENCY", catalog = "prisk", uniqueConstraints = @UniqueConstraint(columnNames = "currency_iso"))
public class CfgCurrency implements java.io.Serializable {
private String currencyIso;
...In the input text I want to assign the value to a String attribute #{rstReportHome.instance.cfgCurrency.currencyIso}, and the values fetched
with the suggestion box are strings. I don´t understand why there is a conversion problem.
I will be appreciated your suggestions.
thanks in advance!