title: How to validate numeric strings in inputText with validateRegex in a JSF-Page
body: <p>I have a managed bean with this string property</p>
  
  <p><code>private String itemNumber;</code></p>
  
  <p>In the JSF I want to validate the input for length of 10 characters and allow only digits. The input will have preceding zeros. For example "0000123456"</p>
  
  
  
  <pre class="lang-html prettyprint-override"><code>&lt;h:inputText value="#{testBean.itemNumber}"&gt;
    &lt;f:validateRegex pattern="\d\d\d\d\d\d\d\d\d\d" /&gt;
  &lt;/h:inputText&gt;
  </code></pre>
  
  
  
  <p>On input of "asdf123456' I will get an beatiful validation message. 
  But on input of "0000123456" I will get this exception</p>
  
  <p><code>java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String</code></p>
  
  <p>What is wrong? Any ideas?</p>