You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Eivind Ronnevik <ei...@kadme.com> on 2008/08/12 17:08:34 UTC

Bug in myfaces Core 1.2 HtmlCheckboxRendererBase?

Hi!

 

I try to build up a form programmatically, and one of my inputs should be a checkbox.

 

I decided to use the HtmlSelectBooleanCheckbox, and create it like this:

 

HtmlSelectBooleanCheckbox myCheckBox = new HtmlSelectBooleanCheckbox();

myCheckBox.setId("checkBox");

myCheckBox.setValueExpression("value", FactoryUtil.createValueExpression("#{myHandler.myProperty}"));

 

The valueExpression points to a property in my bean which is of type boolean:

 

private boolean myProperty;

 

public boolean isMyProperty()

{

      return myProperty;

}

public void setMyProperty(boolean myProperty)

{

      this.myProperty = myProperty;

}

 

But then, when the page is rendered, I get this exception:

[javax.faces.webapp._ErrorPageWriter] An exception occurred

 

......

 

Caused by: javax.faces.FacesException: Exception while calling encodeEnd on component : {Component-Path : [Class: org.ajax4jsf.component.AjaxViewRoot,ViewId: /j

sp/rms.jsp][Class: org.apache.myfaces.custom.document.Document,Id: j_id_jsp_468375984_1][Class: javax.faces.component.html.HtmlForm,Id: mainForm][Class: org.aja

x4jsf.component.html.HtmlAjaxOutputPanel,Id: mainPanel][Class: javax.faces.component.html.HtmlPanelGrid,Id: mainComponentPanel][Class: javax.faces.component.htm

l.HtmlPanelGrid,Id: MainPanel][Class: javax.faces.component.html.HtmlPanelGrid,Id: UserPanel][Class: javax.faces.component.html.Html

SelectBooleanCheckbox,Id: checkBox]}

        at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:610)

        at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:522)

        at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:231)

        at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:102)

        at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:607)

        ... 58 more

Caused by: java.lang.IllegalArgumentException: Cannot convert false of type class java.lang.Boolean to class [Ljava.lang.String;

        at org.apache.el.lang.ELSupport.coerceToType(ELSupport.java:374)

        at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188)

        at javax.faces.component.UIOutput.getValue(UIOutput.java:68)

        at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getObjectValue(RendererUtils.java:216)

        at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getBooleanValue(RendererUtils.java:171)

        at org.apache.myfaces.shared_impl.renderkit.html.HtmlCheckboxRendererBase.encodeEnd(HtmlCheckboxRendererBase.java:61)

        at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:607)

        ... 62 more

 

So, it seems that there is something wrong in the converter then or? Because I should use a boolean property in my bean?

 

I am using myFaces-1.2.3 together with tomahawk-1.1.6 and richFaces 3.2.1

 

Any help would be appreciated

 

Regards,

 

Eivind Rønnevik