1

I am updating a p:inputText from a p:commandButton.

View component:

<p:commandButton value="Search" action="#{bean.retrieveInfo}" update="amount"/>
<p:inputText id="amount" value="#{bean.amount}"/>

Bean Field:

private BigDecimal amount;
public BigDecimal getAmount() {
        return amount;
    }

public void setAmount(BigDecimal amount) {
    this.amount = amount;
}

When the page is loaded, as inspected, amount is null in the setter but when click on command button updated p:inputText, the backing bean field amount gets initialized and takes up a zero intValue as shown below:

enter image description here

BigDecimal being a wrapper, I wanted to keep it uninitialized (null), as it is, until I initialize the same. Until the end of the command button listener code, amount was null. And then update="amount" invoked the setter with an initialized (non null) zero value. Don't know why and where it is getting initialized. Please have a look into it.

user2918640
  • 473
  • 1
  • 7
  • 25
  • You didn't tell much about your environment and configuration, but is this acceptable as dupe? http://stackoverflow.com/questions/14334188/how-to-make-number-input-area-initially-empty-instead-of-0-or-0-00/ – BalusC Jul 21 '15 at 11:01

0 Answers0