aspose file tools*
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
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
Author

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

Luca Manenti
Greenhorn

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();
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can get the value of a HtmlInputText (created in the bean)