myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kal stevens" <kalstev...@gmail.com>
Subject Does SelectItem value have to be a string?
Date Fri, 09 Feb 2007 19:47:55 GMT
I have the code pasted below, and I get the following error

javax.servlet.ServletException: Value is no String
(class=java.util.ArrayList, value=[[2820] three, [2821] emi, [2822]
emi_uk, [2823] itn, [2824] abc, [2825] ae, [2826] boomchicago, [2827]
chillitv, [2828] comedytime, [2829] criticalcontents, [2830] disney,
[2831] deltatre, [2832] endemol, [2833] fashiontv, [2834]
hitentertainment, [2835] hollywoodlic, [2836] ifilms, [2837] kamera,
[2838] setanta, [2839] sports, [2840] news, [2841] northonetv, [2842]
teamtalk, [2843] tvnewmedia, [2844] bbc, [2845] weatherchannel, [2846]
offthefence, [2847] zonemedia]) and component reportForm:cpvaluewith
path: {Component-Path : [Class:
javax.faces.component.UIViewRoot,ViewId:
/jsp/reports/reportGenerator.jsp][Class:
javax.faces.component.html.HtmlForm,Id: reportForm][Class:
org.apache.myfaces.component.html.ext.HtmlSelectOneListbox,Id:
cpvalue]} does not have a Converter
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
	org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
	rhythm.marketplace.filters.SessionFilter.doFilter(SessionFilter.java:69)
	rhythm.marketplace.filters.AuthFilter.doFilter(AuthFilter.java:152)


So Is f:selectItems valid when I give it a List<SelectItem> when the
SelectItem is constructed with an Object and a String?

It takes in an object not a String, so I assumed this would be valid.

Thanks

Kal

------------------------JSF Page
-----------------------------------------------------------
    <x:selectOneListbox value="#{reportGeneratorBean.selectedProvider}"
id="cpvalue">
        <f:selectItems value="#{reportGeneratorBean.selectItemProviders}"
id="selectCPItems"/>
    </x:selectOneListbox>



-------------------------Backing Bean
-------------------------------------------------
    private List<ContentProvider> selectedProvider;

    public List<ContentProvider> getSelectedProvider() {
        return selectedProvider;
    }

    public void setSelectedProvider(List<ContentProvider> selectedProvider)
{
        this.selectedProvider = selectedProvider;
    }


    public List<SelectItem> getSelectProviders() {
        List<SelectItem> returnVal = new ArrayList<SelectItem>();
        List<ContentProvider> cps = getContentProviders();
        returnVal.add(new SelectItem(cps, "all"));
        for (ContentProvider cp:cps) {
            List<ContentProvider> cpList = new ArrayList<ContentProvider>();
            cpList.add(cp);
            returnVal.add(new SelectItem(cpList, cp.getName()));
        }
        return returnVal;
    }

Mime
View raw message