Announcement Announcement Module
Collapse
No announcement yet.
<h:inputText> only for numbers Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • <h:inputText> only for numbers

    Hi,
    I´m working with Spring MVC, WebFlow and Spring Faces.
    I would like to create an input-textfield which sets an int-value in a bean.

    <h:inputText id="input" value="#{mybean.value}" />

    public void setValue(int value)
    {
    this.value = value;
    }

    That works so far. But if the user types in a value that can´t be casted (not a number) the setValue-method won´t be invoked.
    Is there a possibility to ignore that input and show an error-message to the user? do i have to check this in the flow? or what is the normal procedure for this case?
    I tried sth with <f:validator..> and <f:validateLongRange /> but it doesn´work because the setValue-method has been invoked before (I think..).

    Thanks!
Working...
X