This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Luca Manenti
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!