1 Reply Latest reply on Jan 21, 2010 11:40 AM by tmalatinszki

    InputHidden field's value binding to seam component's property

    pramanish
      Hi all,

      In my .xhtml page, i want to take one jsf form with inputHidden element.
      Here, i want to give value to this hidden field and want to bind that value to the respective property of the seam component.

      i.e
      <h:inputHidden value="30" binding="#{mySeamComponent.duration} />

      Here, i want to set value 30 to my mySeamComponent's duration property.

      With the current code i am getting following exception:
      binding="#{mySeamComponent.duration}": java.lang.IllegalArgumentException: java.lang.ClassCastException@103e248

      Can anybody suggest me how i can bind value passed to inputHidden field to my bean/seam component  property?

      Thanks a lot in advance.

      Manish
        • 1. Re: InputHidden field's value binding to seam component's property
          tmalatinszki

          Hi Manish,


          If You want to bind only the value of this h:inputHidden to duration variable (which is an Integer or String, or something like that), You can do it this way:


          <h:inputHidden value="#{mySeamComponent.duration}"/>


          private String duration = "30";
          
          // getters-setters



          Using the binding attribute the duration variable's type should be HtmlInputHidden, in this case You can get its value this way:


          <h:inputHidden value="30" binding="#{mySeamComponent.duration}"/>


          private HtmlInputHidden duration = new HtmlInputHidden();
          
          // getters-setters
          
          Object value=duration.getValue();



          I hope I not misunderstand Your question.


          Regards,


          Tamas