• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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();
newIT.setId("test");
newIT.setValue("test1");
dataMB.setEditableInputText(newIT);
}

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
 
To do a great right, do a little wrong - shakepeare. twisted little ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic