I see that myfaces includes a BooleanConverter, but when I add this to my
faces-config.xml file ...
<converter>
<converter-id>booleanConverter</converter-id>
<converter-class>javax.faces.convert.BooleanConverter</converter-class>
</converter>
and my selectBooleanCheckbox element is
<h:selectBooleanCheckbox value="#{emailController.fields.addToENews}"
converter="booleanConverter" />
but I'm still getting this error upon visiting my page
(emailController.fields.addToENews returns a string) ...
java.lang.IllegalArgumentException: Expected submitted value of type Boolean
for Component : {Component-Path : [Class:
javax.faces.component.UIViewRoot,ViewId:
/contactInfo.jsp][Class: javax.faces.component.html.HtmlForm,Id:
contactInfo][Class:
javax.faces.component.html.HtmlSelectBooleanCheckbox,Id: _idJsp1]}
at
org.apache.myfaces.shared_impl.renderkit.RendererUtils.getBooleanValue(RendererUtils.java:157)
at
org.apache.myfaces.shared_impl.renderkit.html.HtmlCheckboxRendererBase.encodeEnd(HtmlCheckboxRendererBase.java:62)
at
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:498)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:366)
at _jsp._contactInfo__jsp._jspService(contactInfo.jsp:106)
at com.caucho.jsp.JavaPage.service(JavaPage.java:60)
at com.caucho.jsp.Page.pageservice(Page.java:579)
at
com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:175)
at
com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:115)
at
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at
com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:277)
at
com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:106)
at
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
at
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
at
org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
at
com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:106)
at
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
at
com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:178)
at
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:268)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:389)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:507)
at com.caucho.util.ThreadPool.run(ThreadPool.java:433)
at java.lang.Thread.run(Thread.java:613)
How do converters work? - Dave
Mike Kienenberger wrote:
>
> I realize now that I ignored the whole "addToENews is a string" part
> of the email.
> What I said is still true, but you probably need a boolean converter
> on your <h:selectBooleanCheckbox>.
>
> On Thu, Oct 1, 2009 at 4:27 PM, Mike Kienenberger <[email protected]>
> wrote:
>> "x == y" is a read-only expression, and probably isn't allowed for a
>> value in <h:selectBooleanCheckbox>.
>>
>> Why not use value="#{emailController.fields.addToENews}"?
>>
>> This assumes that 'fields' has a getter for an addToENews property.
>>
>> On Thu, Oct 1, 2009 at 1:14 PM, laredotornado <[email protected]>
>> wrote:
>>>
>>> Thanks for your reply but that didn't work. I changed to what you
>>> specified
>>> but still get the error
>>>
>>> Parsed Expression of unsupported type for this operation. Expression
>>> class:
>>> org.apache.commons.el.BinaryOperatorExpression. Expression:
>>> '#{emailController.fields.addToENews == true}'
>>>
>>> upon submitting my form. Any other advice is appreciated, - Dave
>>>
>>>
>>>
>>> Anton Gavazuk wrote:
>>>>
>>>> <h:selectBooleanCheckbox value="#{emailController.fields.addToENews
>>>> ==true}"
>>>> />
>>>>
>>>> 2009/10/1 laredotornado <[email protected]>
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I'm using MyFaces 1.1 for a web app deployed in Resin 3.0.19. This is
>>>>> the
>>>>> expression I have ...
>>>>>
>>>>> <h:selectBooleanCheckbox value="#{emailController.fields.addToENews ==
>>>>> 'true'}" />
>>>>>
>>>>> but when I submit my page containing this, I get the error
>>>>>
>>>>> Parsed Expression of unsupported type for this operation. Expression
>>>>> class:
>>>>> org.apache.commons.el.BinaryOperatorExpression. Expression:
>>>>> '#{emailController.fields.addToENews == 'true'}'
>>>>>
>>>>> Any ideas how I can rewrite the expression to produce the desired
>>>>> result?
>>>>> Essentially I'm trying to convert a string to a boolean within JSF.
>>>>>
>>>>> Thanks, - Dave
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Trouble-converting-String-to-boolean-in-JSF-tp25696928p25696928.html
>>>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Trouble-converting-String-to-boolean-in-JSF-tp25696928p25703041.html
>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Trouble-converting-String-to-boolean-in-JSF-tp25696928p25706851.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.