When I run a JSF application every inputText has a '0', so I can not see the placeholder unless I delete the '0'. That is because the atributes in the ManagedBean are int. The atributes that are String don't cause this problem becuase the are initialized like this strName="";
How could I do to solve the problem and not to see the '0' value those inputText? Is there a better solution than creating those atribues String instead of int and casting to int when neccesary?
XHTML
<h:inputText id="num2" label="num2" required="true" size="5" maxlength="5"
styleClass="#{component.valid ? '' : 'validation-failed'}"
value="#{sumaManagedBean.number2}" p:placeholder="Number"
requiredMessage="Enter a number">
<f:validator validatorId="numberValidator" />
</h:inputText>
<h:message for="num2" />
ManagedBean
@ManagedBean
@SessionScoped
public class SumaManagedBean implements Serializable
{
int number2;
public SumaManagedBean() {
}
//Getters and Setters
public int getNumber2() {
return number2;
}
public void setNumber2(int number2) {
this.number2 = number2;
}
}