I have an <h:selectOneListbox> in my xhtml file and when the user select a value I would like to display the selected value within an <h:inputText> below the page, or using a pop up or to another xhtml. I know that <h:inputText> component is used for retrieving data from the users, however i want to display it some way near to a <h:inputText> in order to give the opportunity to the users to perform some predicates e.g child > 12 (child is the selected value). But I didn't find a way to achieve that yet.
I was thinking that the reason is: UI components for User interface are in the Client side whereas the selected value after the selection of the value are in the Server side (myBean). Is it correct ?
UIComponent objects reside only on the server. They are rendered into HTML to provide the client View.
So you have 2 options.
1. Use AJAX so that when the parent control (selectOneListBox) is changed, an AJAX request updates the backing bean and fires an action that causes the backing property value of the inputText to change (you also have to inform the AJAX mechanism to re-render the inputText).
Customer surveys are for companies who didn't pay proper attention to begin with.
setNewValue is an unfortunate choice for a Listener method name - it can be confused with legitimate property mutators, since it begins with "set". A better name would be something more like "selectItemsListener". Do not include "()" on the EL. JSF already knows that there's a listener method call and I think you're confusing it, since you've coded it as a no-argument method call.
Why the item ID "input" isn't resolvable I'm not sure. I have been shirking my studies on the f:ajax tag, although I can't do that much longer.
Joined: Mar 11, 2012
I tried a lot but I have the same problem, My xhtml file does not recognise the selectItemsListener. Always there is an unknown method selectItemsListener. Have I forgotten something else?
I have <h:form> tags in my xhtml and I included the import javax.faces.event.AjaxBehaviorEvent; in my bean. I am using @SessionScoped
Joined: Mar 11, 2012
It works, I had a mistake in myBean, I didn't define correct the getter method of my listenerItems.
Unfortunately, it is displayed properly only using <h: outputText> tag. If I used <h:inputText> tag I get an error of Conversion Error setting value.
Are you sure that it can be worked using an input control ?
Converters are used to translate between binary and text formats. They are required because HTML is a text-only representation and therefore any binary data must be converted. Likewise, when you enter text into an HTML form control and JSF is backing that control with a binary property such as an "int", the converter manages that task as well.
If the selected converter cannot convert - for example, you typed the value "Fred" into a textbox mapped to a numeric property, a conversion error gets thrown.
subject: Display the selected value within an <h:inputText>