Q:

JSF /Primefaces select one menu causing issues

My index.xhtml looks like 
<p:selectOneMenu value="#{tBean.selectedChartType}"
                    converter="entityConverter">
                    <f:selectItems value="#{tBean.chartTypes}" var="chart"
                        itemLabel="#{chart}" />
</p:selectOneMenu>

This presents ENUM list from my managed bean 
private List<ChartType> chartTypes = Arrays.asList(ChartType.values());

My Enum
public enum ChartType {

    Line("line"), Spiral_Line("spline"), Area("area"), Spiral_Area("areaspline");
    private String code;

    private ChartType(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
}

Now when I run this .jsf on browser sometimes it throw error :
XML Parsing Error: undefined entity
Location: http://xxxx/index.sf
Line Number 54, Column 733:

When I look at the source code I have found 
&nbsp;

which is causing this error I guess.
I am using JSF 2.2.0 and Primefaces 3.5
could someone please help me out with this issue?

A:

A little late to help the asker, but perhaps can help someone: I got this same error and the only way I could get around it was adding the attribute contentType="text/html" to my <f:view>, as in
<f:view contentType="text/html">
...
  <p:selectOneMenu>
    <f:selectItem itemLabel="test" itemValue="test"/>
  </p:selectOneMenu>
...
</f:view>

This occurs, afaik, because p:selectOneMenu renders a &nbsp; and this character is not a xml entity. As my page uses DOCTYPE XHTML 1.0 Transitional, this causes the error to occur. 
HTH.

