Search code examples
javajsffaceletsicefaces

custom facelet component for input field


I'm creating a "big" form with a lot of input fields. To make things easier I tried to create a facelet componente which encapsulates the code for creating a table with two columsn where the first col contains the label and the second one the input field.

The tag which includes the component looks like this:

<ft:textInput cid="city" label="City:" 
       value="#{registrationBean.deal.city> }" />

The textInput component's source (simplified):

  <param name="inputField" value="#{value}" />
    <ice:inputText id="#{cid}" value="#{inputField}"                             
                required="true">        
    </ice:inputText>

While the form looks quiet nice I have the problem that the user's value is not written back into the bean. I think the reason is that #{registrationBean.deal.city} is only evaluated once but not when the form is submitted. I guess I have some serious error in reasoning here but I can't find good document about that.

Thanks for any hints.


Solution

  • I'm not sure why this is the case, since I don't use the f:param tag very often, but you can set

    <ice:inputText id="#{cid}" value="#{value}" required="true"/>
    

    directly. That's what I do and it works great.