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:
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.