This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes How can get the value of a HtmlInputText (created in the bean) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How can get the value of a HtmlInputText (created in the bean) " Watch "How can get the value of a HtmlInputText (created in the bean) " New topic

How can get the value of a HtmlInputText (created in the bean)

Luca Manenti

Joined: Nov 15, 2008
Posts: 2
Hi All,

I have created a HtmlInputText object in the Backing Bean (the getter and setter are in another Bean used to manage the data, getEditableInputText and setEditableInputText)

//Bean that manages data------------------------------
private transient HtmlInputText editableInputText;

//getter and setter in Bean
public HtmlInputText getEditableInputText() {
return this.editableInputText;}

public void setEditableInputText(HtmlInputText editableInputText) {
this.editableInputText = editableInputText;

I set the value in the Backin Bean in onContextChanged

public void onContextChanged() {

//dataMB object created in this line(the bean to manage data)...
//HtmlInputText created and ID set
HtmlInputText newIT = new HtmlInputText();

The HtmlInputText is bound in the jsp page in this way:

<h:inputText id="test" binding="#{Bean.editableInputText}"></h:inputText>

When I load the page I can see the TextField with the value that I set previously "test1"(in the backin bean).

The problem is when I try to change manually the value of the textField:
I input a value, then I click on a button (its action is to call a method to get the value of the field ->dataMB.getEditableInputText.getValue()).

In debug mode I see that the value is allways the first set instead of the new value inserted.

I tried with getValue and similar but it does not work.
I tried also to put HtmlInputText in a panel (using a similar logic) and then to get it using getChildren() method but also this does not work.

Any idea?

Thanks in advance
I agree. Here's the link:
subject: How can get the value of a HtmlInputText (created in the bean)
Similar Threads
value binding inputText
Radio slected should populate the Input text box
binding vs value
Problem with loading the data after Value Change Listener on selectonemenu
Conversion Error setting value