selectonmenu broken on M4

UI Components for JSF
Post Reply
caioatiladf
Posts: 39
Joined: 21 Jun 2011, 18:41

09 Nov 2011, 16:04

After migrating my system for the M4, all my applications selectonmenu who had stopped working with the following error message:

"com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException GRAVE: Error Rendering View[/pages/nuance/Create.xhtml] javax.el.ELException: Cannot convert 0 of type class java.lang.String to class primepad.entidades.Produto"

This is because in my <f:selectItem itemLabel="Selecione um Produto" itemValue="0" /> I put the command itemValue = "0". that worked very well in the previous version and this version has stopped working.

If I remove the command itemValue = "0" the application back to work, however if I leave my field filled with nothing of one another due to the error value is passed as a String. What I find is that this new version does not call the M4 he converting so that the implementation is starter, as it did before.

my code:

Code: Select all

                                                               <p:selectOneMenu effect="drop" style="width:210px" id="codigoProduto" 								
									value="#{bean.nuance.proCodigo}" converter="produtoConverter" >
									<f:selectItem itemLabel="Selecione um Produto" itemValue="0" />
									<f:selectItems value="#{bean.lista}" var="prod" 
										itemLabel="#{prod.proNome}" itemValue="#{prod}" />
								</p:selectOneMenu>

porthos
Posts: 122
Joined: 09 May 2011, 03:17

11 Nov 2011, 02:05

The M4 behaviour seems to me to be the correct one, because the item value should be an object, not a String. Your converter should convert the value to a String when rendering.

I would suggest either leaving itemValue blank for the option without value, or if you are using the Null Object pattern for the class, you could use a reference to the Null Object constant.
-------
PrimeFaces 3.4, Glassfish 3.1.2, Mojarra 2.1.6

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests