myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Korherr <jakob.korh...@gmail.com>
Subject Re: This is a bug?
Date Wed, 16 Dec 2009 13:12:32 GMT
Hi Rafael,

You have to use String instead of Character for the option property in Bean,
because <f:selectItem> generates a String value for itemValue="A".

If you really want to use a Character though, you have to make sure that
<f:selectItem> generates values of type Character and also provide a
Character-converter for <h:selectOneMenu>.

Regards,

Jakob Korherr


2009/12/16 SANTINI, Rafael <rafael@santini.eti.br>

> Hi,
>
> I can't figure out why "value is not valid" is throwed. I'm using
> myfaces-core-1.1.7.
>
> Test case:
>
> <h:form>
>  <h:outputText value="Option:"/>
>  <h:selectOneMenu value="#{bean.option}" id="option">
>   <f:selectItem itemValue="A" itemLabel="A"/>
>   <f:selectItem itemValue="B" itemLabel="B"/>
>   <f:selectItem itemValue="C" itemLabel="C"/>
>  </h:selectOneMenu>
>  <h:message for="option"/>
>  <h:commandButton value="Test" action="#{bean.test}"/>
> </h:form>
>
> public class Bean {
>
>   private Character option = 'A';
>
>   public Character getOption() {
>       return option;
>   }
>
>   public void setOption(Character option) {
>       this.option = option;
>   }
>
>   public void test() {
>       System.out.println(option);
>   }
>
> }
>
> This is a bug? What I'm missing?
>
> Thanks,
>
> Rafael Santini
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message